-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Reuse workflow for automerge in cookiecutter-django
- Loading branch information
1 parent
d2d2c41
commit 20f97a4
Showing
1 changed file
with
5 additions
and
32 deletions.
There are no files selected for viewing
37 changes: 5 additions & 32 deletions
37
cookiecutter-django/{{cookiecutter.project_slug}}/.github/workflows/automerge.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,8 @@ | ||
# The pull_request_target workflow trigger is dangerous. Do not add unrelated logic to this workflow. | ||
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | ||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target | ||
name: Auto-merge | ||
on: pull_request_target | ||
permissions: | ||
pull-requests: write # to approve the PR | ||
contents: write # to merge the PR | ||
jobs: | ||
dependabot: | ||
if: ${{ "{{" }} github.event.pull_request.user.login == 'dependabot[bot]' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: dependabot-metadata | ||
uses: dependabot/fetch-metadata@v2 | ||
with: | ||
github-token: ${{ "{{" }} secrets.GITHUB_TOKEN }} | ||
- if: ${{ "{{" }} steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' || steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions' }} | ||
env: | ||
GITHUB_TOKEN: ${{ "{{" }} secrets.GITHUB_TOKEN }} | ||
run: gh pr review --approve ${{ "{{" }} github.event.pull_request.html_url }} | ||
- if: ${{ "{{" }} steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' || steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions' }} | ||
env: | ||
GITHUB_TOKEN: ${{ "{{" }} secrets.GITHUB_TOKEN }} | ||
run: gh pr merge --auto --squash ${{ "{{" }} github.event.pull_request.html_url }} | ||
precommit: | ||
if: ${{ "{{" }} github.event.pull_request.user.login == 'pre-commit-ci[bot]' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- env: | ||
GITHUB_TOKEN: ${{ "{{" }} secrets.GITHUB_TOKEN }} | ||
run: gh pr review --approve ${{ "{{" }} github.event.pull_request.html_url }} | ||
- env: | ||
GITHUB_TOKEN: ${{ "{{" }} secrets.GITHUB_TOKEN }} | ||
run: gh pr merge --auto --squash ${{ "{{" }} github.event.pull_request.html_url }} | ||
automerge: | ||
uses: open-contracting/.github/.github/workflows/automerge.yml@main | ||
permissions: | ||
pull-requests: write | ||
contents: write |