blob: ad267334af9372817952f03e56646b414de8b9b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
name: Dependabot Approve
on:
pull_request_target:
types:
- opened
jobs:
dump:
runs-on: ubuntu-20.04
permissions: {}
steps:
- name: Dump GitHub context
env:
GH_CXT: ${{ toJson(github) }}
run: echo "${GH_CXT}"
approve:
runs-on: ubuntu-20.04
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
permissions:
contents: read
pull-requests: read
steps:
- name: Dependabot metadata
id: meta
uses: dependabot/fetch-metadata@v1.3.3
- uses: actions/checkout@v3
- name: Approve
if: |
(steps.meta.outputs.package-ecosystem == 'github_actions') ||
(steps.meta.outputs.package-ecosystem == 'go_modules' && steps.meta.outputs.directory == '/deps') ||
(steps.meta.outputs.package-ecosystem == 'npm_and_yarn' && steps.meta.outputs.directory == '/' ) ||
(steps.meta.outputs.package-ecosystem == 'npm_and_yarn' && steps.meta.outputs.directory == '/exampleSite' && steps.meta.outputs.update-type == 'version-update:semver-minor') ||
(steps.meta.outputs.package-ecosystem == 'npm_and_yarn' && steps.meta.outputs.directory == '/exampleSite' && steps.meta.outputs.update-type == 'version-update:semver-patch')
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
gh pr checkout "${PR_URL}" # sets the upstream metadata for `gh pr status`
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; then
gh pr review --approve "${PR_URL}"
else
echo "PR already approved, skipping additional approvals to minimize emails/notification noise.";
fi
|