Skip to content

Commit 1907b4f

Browse files
Merge pull request #9805 from rafaeltonholo/ci/add-dependabot-dependency-guard-update-workflow
ci(dependabot): add workflow to automatically update dependency guard when dependabot creates a PR
2 parents 7e7ecd0 + c72d3a3 commit 1907b4f

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: dependabot PR - Update dependency guard
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
branches:
10+
- main
11+
paths:
12+
- '**/*.gradle'
13+
- 'gradle/**'
14+
- 'gradlew'
15+
- '**/libs.versions.toml'
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.pull_request.number || 'no-pr' }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
update-dependency-guard:
23+
if: github.actor == 'dependabot[bot]'
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 90
26+
steps:
27+
- name: Checkout the repo
28+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
29+
with:
30+
ref: ${{ github.head_ref }}
31+
32+
- name: Prepares environment
33+
uses: ./.github/actions/setup
34+
35+
- name: Update dependency guard
36+
run: ./gradlew :dependencyGuardBaseline
37+
38+
- name: Commit and push changes if any
39+
# The email address is composed by {user.id}+{user.login}@users.noreply.github.com
40+
# See https://api.github.com/users/github-actions%5Bbot%5D for more details.
41+
run: |
42+
git config --global user.name "github-actions[bot]"
43+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
44+
git add .
45+
if ! git diff --cached --quiet; then
46+
git commit -m "chore(deps): Update dependency guard files on behalf of @dependabot"
47+
git push
48+
else
49+
echo "No changes to commit"
50+
fi

0 commit comments

Comments
 (0)