Skip to content

Commit

Permalink
Merge pull request #472 from boozook/ci-update-impr
Browse files Browse the repository at this point in the history
CI: add auto-approve for update workflow
  • Loading branch information
boozook authored Feb 1, 2025
2 parents 8f3b2b8 + fba2326 commit a826fa5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Labels"
name: Triage
on:
pull_request_target:
workflow_dispatch:
Expand All @@ -9,7 +9,8 @@ on:
required: false

jobs:
triage:
labels:
name: Labels
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
40 changes: 39 additions & 1 deletion .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ jobs:

- name: Create PR
id: pr
uses: TreTuna/sync-branches@1.4.0
uses: TreTuna/sync-branches@main # use @1.4.0+
with:
GITHUB_TOKEN: ${{secrets.PR_GITHUB_TOKEN}}
FROM_BRANCH: refs/heads/${{ needs.new-branch.outputs.working }}
Expand All @@ -343,10 +343,48 @@ jobs:
PULL_REQUEST_IS_DRAFT: false
CONTENT_COMPARISON: true
# REVIEWERS: '["boozook"]'
PULL_REQUEST_AUTO_MERGE_METHOD: squash
outputs:
number: ${{ steps.pr.outputs.PULL_REQUEST_NUMBER }}
url: ${{ steps.pr.outputs.PULL_REQUEST_URL }}

accept:
name: Accept
needs: [new-branch, pr]
runs-on: ubuntu-latest
continue-on-error: true
defaults:
run:
shell: bash
permissions:
pull-requests: write
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: PR
run: |
echo "URL: ${{ needs.pr.outputs.url }}"
echo "ID: ${{ needs.pr.outputs.number }}"
echo "Any: ${{ needs.pr.outputs.url || needs.pr.outputs.number }}"
# needed when using PR-number instead of url
- uses: actions/checkout@v4
with:
ref: ${{ needs.new-branch.outputs.working }}

- name: Approve
if: needs.pr.outputs.url
run: gh pr review --approve "${{ needs.pr.outputs.number || needs.pr.outputs.url }}"

- name: Auto-merge
if: success()
env:
GITHUB_TOKEN: ${{secrets.PR_GITHUB_TOKEN}}
run: >-
gh pr merge --auto --squash
"${{ needs.pr.outputs.number || needs.pr.outputs.url }}"
# tests:
# name: Tests
# needs: [new-branch, pre-gen, changes]
Expand Down

0 comments on commit a826fa5

Please sign in to comment.