Closed casperklein closed 3 years ago
Thanks for opening your first issue here! Be sure to follow the issue template!
Everything looks good :thumbsup:
Everything looks good :thumbsup:
Great idea!
So do you want to send me a PR on this feature @casperklein? Or I will do it next week, as I'm busy this week.
Besides, do you think an additional param like PULL_REQUEST
is good for use? You can specify the PR from head
branch to base
branch in format <head>:<base>
. A PR will only be opened when file is updated.
Unfortunately, I cannot provide a PR (I am totally unfamiliar with python). I understand, that a FR can take some time to get implement or is not implemented at all 👍
I see two options to implement this:
PULL_REQUEST
as boolean true/false
(default: false, to not break existing setups)COMMIT_MODE
with values of (commit|pr)
. Default: commit
Ok, thank you for your suggestions on the FR, I will consider them next week to see how to implement this feature
Hi, because you can use format <branch>:<file>
in the parameter PATH
to specify which branch to push your changes(I will make the reference more clearly), so I would like to implement this FR like this:
PULL_REQUEST_TARGET
to set the target branch. Default set to ''
means do not open a pull request. Only if the target branch is different with the file branch and the file is updated, will the GA open a new pr.How do you like this idea? @casperklein
TBH I find this a bit confusing at first. I would stick with "one parameter - one option":
That said, the same goes for the current PATH parameter. I would equalize it:
PATH
Path to the file you want to add contributors' listBRANCH
Specify the branch of the file, defined in path. (optional)This approach would make the "PATH note" below the parameter table in the README obsolete - which will surely be overlooked by some (including me until now 😄). If you want to keep it as it is, I suggest adding the note text to the PATH description in the table.
In the end, it's up to you. Whatever works, is good 👍
Really good suggestions. I will break the original PATH
into PATH
and BRANCH
. But to the PULL_REQUEST feature, I still decide to add one param PULL_REQUEST
. If you want to open a pr, then set PULL_REQUEST
to the target branch, and if you don't want to open a pr, simply skip the param.
Anyway, thank you for your suggestions.
@casperklein
Hi, I have added the new feature, so could you please test it to see if it satisfies your opinion?
For sure. Can you advice me, how to do so?
uses: BobAnkh/add-contributors@v0.2.1
Is there a way, to use the "master" branch of your repo as action instead of the version?
I recommend you to use the format in the workflow in this repo temporarily to use the master branch:
uses: BobAnkh/add-contributors@master
And after tested, I will release a new version, so that you can use the new version then.
main()
File "/main.py", line 318, in main
Contributors.write_data(content)
File "/main.py", line 115, in write_data
self.repo.create_pull(title=self.COMMIT_MESSAGE, base=self.PULL_REQUEST, head=self.BRANCH)
File "/usr/local/lib/python3.9/site-packages/github/Repository.py", line 1350, in create_pull
return self.__create_pull_2(*args, **kwds)
TypeError: __create_pull_2() got an unexpected keyword argument 'title'
My test repo: https://github.com/barthheiko/docker-mailserver/runs/3698589721?check_suite_focus=true#step:4:239
Ok, I see, I will fix the bug later. Also please remember to set param BRANCH
together with PULL_REQUEST
. Only with both params given will a new pr opened. (e.g. you cannot open a pr from master to master)
Many thanks for help.
you cannot open a pr from master to master
Oh, that's bad (but makes sense 😄). I want to update the master branch, but also need a PR because this branch is protected.
Could your action create a temporary branch and then create a PR from that? I am wondering, how "Dependabot" works. This action also creates a PR against the master branch.
Edit: Or I create a temporary branch myself, a step before running your action. This should work?
Actually I can do the whole process as the dependabot
does, creating a pr, auto-merging it and closing the pr, deleting the branch, etc. But, I suppose this is out of the scope of this action.
Hey, I think this bug has been removed in the recent commit.
(Seems like a kind of weird api design in pygithub)
TypeError: __create_pull_1() missing 1 required positional argument: 'body'
https://github.com/barthheiko/docker-mailserver/runs/3699658794?check_suite_focus=true#step:5:295
I tried to fix it myself: https://github.com/casperklein/add-contributors/commit/d7225406115c1941122f77aded60d5de4bfb2ea4
But now rate-limit kicks in 😠 https://github.com/barthheiko/docker-mailserver/runs/3699790935?check_suite_focus=true#step:5:136
I will try again later.
Really thank you for your help, sorry for missing that param 🙏
You are doing a great job!
Please open a pull request for me @casperklein (don't worry about the contribution convention, and don't worry about the warning by CI, I will fix them).
PS: If your GITHUB_TOKEN exceeds the rate limit, you can change to a personal access token instead temporarily. See here
This was just a quick hack/POC.
I took the the title and used it for the body text. I can provide a PR for that. I probably can hack something together, to make the Body text configurable like the title.
Even better would be, if the body contains the contributors that the PR is going to add:
This pull-request adds the following new contributors:
- new-contributor1
- new-contributor2
This however exceed my copy/paste/hack abilities 😄
Just let me know, if I should supply a PR with static/configurable body text, or if you think it's worth to list the new contributors like I wrote above and look yourself into it.
Really appreciate this interesting feature!
Just open a PR with the static body text(which servers as a temporary solution).
I will take into consider the new FR and implement it when I am free(maybe it is not so easy to implement, for I have to know which contributors is new). Please open a new issue to talk about it. This will server as the content of the body text in the next version if I can implement it.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue.
Is your feature request related to a problem? Please describe
When having a protected branch, you cannot directly commit to that. There must be a PR with approval of several people, checks passed etc (depends on how it is setup).
Description of the new feature/enhancement
Instead of directly committing to the branch, a PR should be opened (but only when there are changes, not every time `add-contributors is run on schedule).