Sunshine/.github/workflows/automerge.yml

65 lines
2.0 KiB
YAML
Raw Normal View History

2022-08-07 23:33:19 +00:00
---
2022-07-30 01:45:02 +00:00
# This action is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.
2023-01-01 03:38:46 +00:00
# This workflow will, first, automatically approve PRs created by @LizardByte-bot. Then it will automerge relevant PRs.
2022-07-30 01:45:02 +00:00
name: Automerge PR
on:
pull_request:
types:
- opened
- synchronize
2023-01-01 03:38:46 +00:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2022-07-30 01:45:02 +00:00
jobs:
2022-07-31 01:48:13 +00:00
autoapprove:
2022-12-10 15:27:26 +00:00
if: >-
2022-07-31 01:48:13 +00:00
contains(fromJson('["LizardByte-bot"]'), github.event.pull_request.user.login) &&
2022-12-10 15:27:26 +00:00
contains(fromJson('["LizardByte-bot"]'), github.actor) &&
startsWith(github.repository, 'LizardByte/')
2022-07-31 01:48:13 +00:00
runs-on: ubuntu-latest
steps:
2022-08-07 23:33:19 +00:00
- name: Autoapproving
2022-10-19 23:34:36 +00:00
uses: hmarr/auto-approve-action@v3
2022-08-07 23:33:19 +00:00
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
2022-07-31 01:48:13 +00:00
2022-08-07 23:33:19 +00:00
- name: Label autoapproved
2023-11-24 04:28:07 +00:00
uses: actions/github-script@v7
2022-08-07 23:33:19 +00:00
with:
github-token: ${{ secrets.GH_BOT_TOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['autoapproved', 'autoupdate']
})
2022-07-31 01:48:13 +00:00
2022-07-30 01:45:02 +00:00
automerge:
2022-12-10 15:27:26 +00:00
if: startsWith(github.repository, 'LizardByte/')
2022-07-31 01:48:13 +00:00
needs: [autoapprove]
2022-07-30 01:45:02 +00:00
runs-on: ubuntu-latest
steps:
- name: Automerging
2023-03-30 12:34:29 +00:00
uses: pascalgn/automerge-action@v0.15.6
2022-07-30 01:45:02 +00:00
env:
BASE_BRANCHES: nightly
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
GITHUB_LOGIN: ${{ secrets.GH_BOT_NAME }}
2022-12-23 03:47:24 +00:00
MERGE_LABELS: "!dependencies"
2022-07-30 01:45:02 +00:00
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
MERGE_DELETE_BRANCH: true
MERGE_ERROR_FAIL: true
MERGE_FILTER_AUTHOR: ${{ secrets.GH_BOT_NAME }}
2022-07-31 01:48:13 +00:00
MERGE_RETRIES: "240" # 1 hour
MERGE_RETRY_SLEEP: "15000" # 15 seconds