-
Notifications
You must be signed in to change notification settings - Fork 143
71 lines (61 loc) · 2.32 KB
/
post-dependabot.yml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Follow-on actions relating to dependabot PRs. In elastic/elastic-agent, any changes to
# dependencies contained in go.mod requires the change to be reflected in the
# NOTICE.txt file. When dependabot creates a branch for a go_modules change this
# will update the NOTICE.txt file for that change.
name: post-dependabot
on:
push:
branches:
- "dependabot/go_modules/**"
jobs:
update-notice:
permissions:
# Allow job to write to the branch.
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: .go-version
- uses: magefile/mage-action@v3
with:
install-only: true
- name: update NOTICE.txt
run: make notice
- name: check for modified NOTICE.txt
id: notice-check
run: |
if git diff --quiet HEAD -- NOTICE.txt; then
echo "modified=false" >> $GITHUB_OUTPUT
else
echo "modified=true" >> $GITHUB_OUTPUT
fi
- name: commit NOTICE.txt
if: steps.notice-check.outputs.modified == 'true'
run: |
git config --global user.name 'dependabot[bot]'
git config --global user.email 'dependabot[bot]@users.noreply.github.com'
git add NOTICE.txt
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -m "Update NOTICE.txt"
git push
- name: update otel README.md
run: mage otel:readme
- name: check for modified otel README.md
id: otel-readme-check
run: |
if git diff --quiet HEAD -- internal/pkg/otel/README.md; then
echo "modified=false" >> $GITHUB_OUTPUT
else
echo "modified=true" >> $GITHUB_OUTPUT
fi
- name: commit otel README.md
if: steps.otel-readme-check.outputs.modified == 'true'
run: |
git config --global user.name 'dependabot[bot]'
git config --global user.email 'dependabot[bot]@users.noreply.github.com'
git add internal/pkg/otel/README.md
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -m "Update otel README.md"
git push