Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/auto-approve.yml
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:
Comment on lines +11 to +14

Copy link
Copy Markdown

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 permissions block (either at the workflow or job level) to restrict the default GITHUB_TOKEN to the minimum required scopes, e.g. permissions: contents: read. This limits the blast radius if future steps are added or changed.

Suggested change
- synchronize
- ready_for_review
jobs:
- synchronize
- ready_for_review
permissions:
contents: read
pull-requests: write
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.

@v2 will automatically pick up new v2 releases, which can change behavior unexpectedly and increases supply‑chain risk. Please pin this action to a specific commit SHA (optionally with a comment noting the version) so changes are explicit and reviewable.

Suggested implementation:

      - name: Generate bb-auto token
        id: app-token
        # Pin to a specific commit SHA to avoid floating tags (update SHA as needed)
        uses: actions/create-github-app-token@<COMMIT-SHA> # v2.x.x
        with:

  1. Replace <COMMIT-SHA> with the actual commit SHA from the actions/create-github-app-token repository corresponding to the desired v2 release.
  2. Optionally update # v2.x.x to the actual version (e.g. # v2.0.0) to make it clear which release you pinned to.

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"
Loading