-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 1.85 KB
/
dependabot-auto-merge.yaml
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
48
49
50
51
52
53
name: Dependabot auto-merge
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Check if aws-sdk-go-v2 is in the dependency list
id: check
env:
DEPENDENCIES: ${{ steps.metadata.outputs.dependency-names }}
UPDATE_TYPE: ${{ steps.metadata.outputs.update-type }}
run: |
if [[ $UPDATE_TYPE == "version-update:semver-major" ]]; then
if [[ $DEPENDENCIES == "tj-actions/changed-files" ]]; then
echo "match=true" >> $GITHUB_OUTPUT
else
echo "match=false" >> $GITHUB_OUTPUT
fi
elif [[ $UPDATE_TYPE == "version-update:semver-minor" ]]; then
if [[ $DEPENDENCIES == "tj-actions/changed-files" ]]; then
echo "match=true" >> $GITHUB_OUTPUT
else
echo "match=false" >> $GITHUB_OUTPUT
fi
elif [[ $UPDATE_TYPE == "version-update:semver-patch" ]]; then
if [[ $DEPENDENCIES == "github.com/aws/aws-sdk-go-v2"* ]] || [[ $DEPENDENCIES == "tj-actions/changed-files" ]]; then
echo "match=true" >> $GITHUB_OUTPUT
else
echo "match=false" >> $GITHUB_OUTPUT
fi
fi
- name: Approve and Enable auto-merge for Dependabot PRs
if: ${{ steps.check.outputs.match == 'true' }}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}