Skip to content

Commit 6ef1eaa

Browse files
committed
.github/workflows: add dependabump
1 parent 29c0bf1 commit 6ef1eaa

2 files changed

Lines changed: 82 additions & 2 deletions

File tree

.github/workflows/dependabump.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: dependabump
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * 1-5' # every week-day at midnight
7+
8+
permissions: { }
9+
10+
jobs:
11+
dependabump:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
actions: read
17+
security-events: read
18+
env:
19+
GH_TOKEN: ${{ github.token }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v6
23+
with:
24+
ref: main
25+
26+
- name: Set up Go
27+
uses: ./.github/actions/setup-go
28+
with:
29+
go-version-file: "go.mod"
30+
31+
- name: Bump Dependencies
32+
run: make dependabot && echo "test" > test.txt # TODO remove
33+
continue-on-error: true
34+
35+
- name: Notify Failure
36+
if: failure()
37+
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
38+
with:
39+
method: chat.postMessage
40+
token: ${{ secrets.QA_SLACK_API_KEY }}
41+
payload: |
42+
channel: ${{ secrets.SLACK_TEAM_CORE_CHANNEL_ID}}
43+
text: "Failed to run dependabump: <${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}|Run>"
44+
45+
- if: failure()
46+
run: exit 1
47+
48+
- name: Create Pull Request
49+
id: pr
50+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
51+
with:
52+
branch: bot/dependabump
53+
commit-message: "bump dependencies"
54+
title: "dependabump"
55+
body: "Bumping deps due to critical or high vulnerabilities."
56+
sign-commits: true
57+
continue-on-error: true
58+
59+
- name: Notify PR Failure
60+
if: failure()
61+
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
62+
with:
63+
method: chat.postMessage
64+
token: ${{ secrets.QA_SLACK_API_KEY }}
65+
payload: |
66+
channel: ${{ secrets.SLACK_TEAM_CORE_CHANNEL_ID}}
67+
text: "Changes detected by dependabump, but failed to create PR: <${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}|Run>"
68+
69+
- if: failure()
70+
run: exit 1
71+
72+
- name: Notify PR Created
73+
if: steps.pr.outputs.pull-request-operation == 'created' || steps.pr.outputs.pull-request-operation == 'updated'
74+
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
75+
with:
76+
method: chat.postMessage
77+
token: ${{ secrets.QA_SLACK_API_KEY }}
78+
payload: |
79+
channel: ${{ secrets.SLACK_TEAM_CORE_CHANNEL_ID}}
80+
text: "Changes detected by dependabump: <${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}|Run> - <${steps.pr.outputs.pull-request-url}|PR> :review_time:"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ DEPENDABOT_SEVERITY := "critical,high"
6666
endif
6767
dependabot: gomods
6868
gh api --paginate -H "Accept: application/vnd.github+json" --method GET \
69-
'/repos/smartcontractkit/chainlink-common/dependabot/alerts?state=open&ecosystem=Go&severity=$(DEPENDABOT_SEVERITY)' | \
70-
jq -r '.[] | select(.security_vulnerability.first_patched_version != null) | .dependency.manifest_path |= rtrimstr("go.mod") | "./\(.dependency.manifest_path) \(.security_vulnerability.package.name) \(.security_vulnerability.first_patched_version.identifier)"' | \
69+
'/repos/smartcontractkit/chainlink-common/dependabot/alerts?state=open&ecosystem=Go&severity=$(DEPENDABOT_SEVERITY)' \
70+
--jq '.[] | select(.security_vulnerability.first_patched_version != null) | .dependency.manifest_path |= rtrimstr("go.mod") | "./\(.dependency.manifest_path) \(.security_vulnerability.package.name) \(.security_vulnerability.first_patched_version.identifier)"' | \
7171
go run ./script/cmd/dependabot
7272
gomods tidy

0 commit comments

Comments
 (0)