Skip to content

Commit

Permalink
ci: use auto-merge wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Jul 18, 2024
1 parent 4ec966e commit 96c5c08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 51 deletions.
34 changes: 5 additions & 29 deletions .github/workflows/auto-merge-on-demand.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Auto Merge On Demand
name: Auto Merge Scheduled / On Demand
on:
schedule:
# Workflow runs every 45 minutes
- cron: '*/45 * * * *'
# Workflow runs every 30 minutes
- cron: '*/30 * * * *'
workflow_dispatch:
inputs:
pr-number:
Expand Down Expand Up @@ -64,32 +64,8 @@ jobs:
pull-requests: write

steps:
- id: metadata
name: Gather Pull Request Metadata
uses: redhat-plumbers-in-action/gather-pull-request-metadata@v1
- name: Auto Merge wrapper
uses: sclorg/auto-merge-wrapper@v1
with:
pr-number: ${{ matrix.pr-number }}

- id: pull-request-validator
name: Pull Request Validator
uses: redhat-plumbers-in-action/pull-request-validator@v2
with:
pr-metadata: ${{ steps.metadata.outputs.metadata }}
token: ${{ secrets.GITHUB_TOKEN }}

- id: auto-merge
name: Auto Merge
uses: redhat-plumbers-in-action/auto-merge@v2
with:
pr-metadata: ${{ steps.metadata.outputs.metadata }}
token: ${{ secrets.GITHUB_TOKEN }}

- if: ${{ !cancelled() }}
name: Show results in PR comment
uses: redhat-plumbers-in-action/issue-commentator@v1
with:
issue: ${{ fromJSON(steps.metadata.outputs.metadata).number }}
message: |
${{ steps.pull-request-validator.outputs.status && steps.pull-request-validator.outputs.status || '' }}
${{ steps.auto-merge.outputs.status && steps.auto-merge.outputs.status || '' }}
token: ${{ secrets.GITHUB_TOKEN }}
26 changes: 4 additions & 22 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,14 @@ jobs:
runs-on: ubuntu-latest

permissions:
# required for ability to merge Pull Request
# required for merging PRs
contents: write
# required for setting labels
# required for PR comments and setting labels
pull-requests: write

steps:
- id: pull-request-validator
name: Pull Request Validator
uses: redhat-plumbers-in-action/pull-request-validator@v2
- name: Auto Merge wrapper
uses: sclorg/auto-merge-wrapper@v1
with:
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
token: ${{ secrets.GITHUB_TOKEN }}

- id: auto-merge
name: Auto Merge
uses: redhat-plumbers-in-action/auto-merge@v2
with:
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
token: ${{ secrets.GITHUB_TOKEN }}

- if: ${{ !cancelled() }}
name: Show results in PR comment
uses: redhat-plumbers-in-action/issue-commentator@v1
with:
issue: ${{ fromJSON(needs.download-metadata.outputs.pr-metadata).number }}
message: |
${{ steps.pull-request-validator.outputs.status && steps.pull-request-validator.outputs.status || '' }}
${{ steps.auto-merge.outputs.status && steps.auto-merge.outputs.status || '' }}
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 96c5c08

Please sign in to comment.