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
22 changes: 22 additions & 0 deletions .github/workflows/auto-merge-generated-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,27 @@ jobs:
const names = labels.map(l => l.name.toLowerCase());
core.setOutput('match', names.includes('minor') || names.includes('patch'));

- name: Auto-approve pull request
if: steps.labels.outputs.match == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const prNumber = context.payload.pull_request.number;
try {
await github.rest.pulls.createReview({
owner,
repo,
pull_number: prNumber,
event: 'APPROVE',
body: 'Auto-approved: SDK update with minor/patch label'
});
} catch (error) {
core.warning(`Failed to approve PR: ${error.message}. If using GITHUB_TOKEN, you may need to create a Personal Access Token (PAT) and store it as GH_PAT secret.`);
throw error;
}

- name: Enable auto-merge (squash)
if: steps.labels.outputs.match == 'true'
uses: peter-evans/enable-pull-request-automerge@v3
Expand All @@ -35,3 +56,4 @@ jobs:
merge-method: squash
token: ${{ secrets.GITHUB_TOKEN }}