generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PR auto-approve option #24
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,40 @@ jobs: | |
head: master | ||
``` | ||
|
||
## Auto approve | ||
|
||
If you use a workflow which does not allow to merge pull requests without a review | ||
("Require pull request reviews before merging" in your [repo settings](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuring-protected-branches)) | ||
you can set `auto_approve` to `true`. In that case you'll have to provide a [personal access token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) | ||
for a user which is allowed to review the pull requests changes. Make sure the token has at least | ||
`public_repo` permissions and store the token inside of the [repository secrets](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository). | ||
|
||
An example workflow would then look like this: | ||
|
||
```yml | ||
name: Sync Fork | ||
|
||
on: | ||
schedule: | ||
- cron: '*/30 * * * *' # every 30 minutes | ||
workflow_dispatch: # on button click | ||
|
||
jobs: | ||
sync: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: tgymnich/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
owner: llvm | ||
base: master | ||
head: master | ||
auto_approve: true | ||
personal_token: ${{ secrets.PERSONAL_TOKEN }} | ||
``` | ||
|
||
# Parameters | ||
|
||
| name | Optional | Default | description | | ||
|
@@ -41,5 +75,9 @@ jobs: | |
| pr_title | ✅ | Fork Sync | Title of the created pull request | | ||
| pr_message | ✅ | | Message of the created pull request | | ||
| ignore_fail | ✅ | | Ignore Exceptions | | ||
| auto_approve | ✅ * | `false` | Automatically approve pull request before merge | | ||
| personal_token| ✅ | | Usertoken for the user to auto approve the pull request | | ||
|
||
⚠️ $current_repo_owner is your own username! | ||
|
||
⚠️ * if `auto_approve` is set to `true` you must provide the `personal_token`! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the already used
GITHUB_TOKEN
have sufficient permissions to review and approve PRs?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it but Github gave me an error message like "you cannot approve your own pull request" which makes sense somehow ;-)
So there have to be two different users then