Skip to content

Commit

Permalink
[CCXDEV-14176] GH actions: add konflux PR automerging
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Zibricky authored and Martin Zibricky committed Oct 10, 2024
1 parent 0ee43ef commit 3377f4b
Showing 1 changed file with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Set as automatically merge all the pull requests created by dependabot[bot]
name: Dependabot auto-merge
# Set as automatically merge all the pull requests created by dependabot[bot], red-hat-konflux[bot], InsightsDroid.
name: Bots auto-merge
on: pull_request

# This section adds write permissions to the secrets.GITHUB_TOKEN. Default is just read
Expand All @@ -8,30 +8,27 @@ permissions:
pull-requests: write

jobs:
dependabot:
bot-automerge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
# Check the pull request author.
if: |
github.event.pull_request.user.login == 'dependabot[bot]' ||
github.event.pull_request.user.login == 'red-hat-konflux[bot]' ||
github.event.pull_request.user.login == 'InsightsDroid'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# NOTE: PR approval does not work on PRs from forks
- name: Github Actions bot approves the PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{ github.token }}
- name: InsightsDroid approves the PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.INSIGHTSDROID_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
# We can filter depending on the semver major, minor, or patch updates,
# but let's not do it for now
# if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
- name: Enable auto-merge for PR
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
GH_TOKEN: ${{ github.token }}

0 comments on commit 3377f4b

Please sign in to comment.