File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 schedule :
66 - cron : ' 5 4 * */3 0'
77
8+ permissions :
9+ contents : write
10+ pull-requests : write
11+
812jobs :
913 auto-release :
1014 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 1+ # Based on code from https://andre.arko.net/2022/05/15/automatic-dependabot-merges/
2+
3+ name : " Merge updates"
4+
5+ on :
6+ workflow_run :
7+ workflows :
8+ - " Tests and Checks"
9+ types :
10+ - " completed"
11+ branches :
12+ - " dependabot/**"
13+
14+ permissions :
15+ contents : write
16+ pull-requests : write
17+
18+ jobs :
19+ merge :
20+ name : " Merge"
21+ runs-on : " ubuntu-latest"
22+ if : >
23+ github.event.workflow_run.event == 'pull_request' &&
24+ github.event.workflow_run.conclusion == 'success' &&
25+ github.actor == 'dependabot[bot]'
26+ steps :
27+ - name : " Approve pull request"
28+ uses : " juliangruber/approve-pull-request-action@v2"
29+ with :
30+ github-token : " ${{ secrets.IMPRESSBOT_TOKEN }}"
31+ number : " ${{ github.event.workflow_run.pull_requests[0].number }}"
32+
33+ - name : " Merge pull request"
34+ uses : " actions/github-script@v8"
35+ with :
36+ github-token : " ${{ secrets.GITHUB_TOKEN }}"
37+ script : |
38+ const pullRequest = context.payload.workflow_run.pull_requests[0]
39+ const repository = context.repo
40+ await github.rest.pulls.merge({
41+ merge_method: "merge",
42+ owner: repository.owner,
43+ pull_number: pullRequest.number,
44+ repo: repository.repo,
45+ })
Original file line number Diff line number Diff line change 1- name : On pull request
1+ name : Tests and Checks
22
33on :
44 pull_request :
55 branches :
66 - main
7+ types :
8+ - opened
9+ - synchronize
10+ - reopened
11+ - ready_for_review
712
813jobs :
914
5863 run : npm test
5964 env :
6065 PHP_VERSION : ${{ matrix.php_version }}
61-
62- dependabot :
63- needs :
64- - test
65- permissions : write-all
66- runs-on : ubuntu-latest
67- # Checking the actor will prevent your Action run failing on non-Dependabot
68- # PRs but also ensures that it only does work for Dependabot PRs.
69- if : ${{ github.actor == 'dependabot[bot]' }}
70- steps :
71- # This first step will fail if there's no metadata and so the approval
72- # will not occur.
73- - name : Dependabot metadata
74- id : dependabot-metadata
75- uses : dependabot/fetch-metadata@v3.0.0
76- with :
77- github-token : " ${{ secrets.GITHUB_TOKEN }}"
78- # Here the PR gets approved.
79- - name : Approve a PR
80- run : gh pr review --approve "$PR_URL"
81- env :
82- PR_URL : ${{ github.event.pull_request.html_url }}
83- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
84- # Finally, this sets the PR to allow auto-merging for patch and minor
85- # updates if all checks pass
86- - name : Enable auto-merge for Dependabot PRs
87- # if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
88- run : gh pr merge --auto --squash "$PR_URL"
89- env :
90- PR_URL : ${{ github.event.pull_request.html_url }}
91- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments