-
-
Notifications
You must be signed in to change notification settings - Fork 10
chore(Robot): add auto approve action #1021
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Auto Approve PR(bot) | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| - main | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
| - ready_for_review | ||
|
|
||
| jobs: | ||
| auto_approve: | ||
| name: auto approve | ||
| runs-on: ubuntu-latest | ||
| # Only auto-approve PRs from trusted authors; add accounts to the list as needed | ||
| if: | | ||
| github.event.pull_request.draft == false && | ||
| contains(fromJSON('["ArgoZhang"]'), github.event.pull_request.user.login) | ||
|
Comment on lines
+18
to
+21
|
||
|
|
||
| steps: | ||
| - name: Generate bb-auto token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v2 | ||
|
Comment on lines
+24
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 suggestion (security): Pin the GitHub Action to a specific commit SHA instead of a floating major tag.
Suggested implementation:
|
||
| with: | ||
| app-id: ${{ secrets.BB_AUTO_APP_ID }} | ||
| private-key: ${{ secrets.BB_AUTO_PRIVATE_KEY }} | ||
|
|
||
| - name: Approve pull request | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| gh pr review ${{ github.event.pull_request.number }} \ | ||
| --repo ${{ github.repository }} \ | ||
| --approve \ | ||
| --body "Auto approved by bb-auto" | ||
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.
🚨 suggestion (security): Lock down workflow permissions explicitly instead of relying on defaults.
Please add an explicit
permissionsblock (either at the workflow or job level) to restrict the defaultGITHUB_TOKENto the minimum required scopes, e.g.permissions: contents: read. This limits the blast radius if future steps are added or changed.