Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/dependabump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: dependabump

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1-5' # every week-day at midnight

permissions: { }

jobs:
dependabump:
runs-on: ubuntu-latest
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment thread
jmank88 marked this conversation as resolved.
permissions:
contents: write
pull-requests: write
actions: read
security-events: read
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: main

- name: Set up Go
uses: ./.github/actions/setup-go
with:
go-version-file: "go.mod"

- name: Bump Dependencies
run: make dependabot && echo "test" > test.txt # TODO remove
continue-on-error: true

- name: Notify Failure
if: failure()
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.QA_SLACK_API_KEY }}
payload: |
channel: ${{ secrets.SLACK_TEAM_CORE_CHANNEL_ID}}
text: "Failed to run dependabump: <${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}|Run>"

- if: failure()
run: exit 1

- name: Create Pull Request
id: pr
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
branch: bot/dependabump
commit-message: "bump dependencies"
title: "dependabump"
body: "Bumping deps due to critical or high vulnerabilities."
sign-commits: true
continue-on-error: true
Comment thread
jmank88 marked this conversation as resolved.

- name: Notify PR Failure
if: failure()
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.QA_SLACK_API_KEY }}
payload: |
channel: ${{ secrets.SLACK_TEAM_CORE_CHANNEL_ID}}
text: "Changes detected by dependabump, but failed to create PR: <${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}|Run>"

- if: failure()
run: exit 1

- name: Notify PR Created
if: steps.pr.outputs.pull-request-operation == 'created' || steps.pr.outputs.pull-request-operation == 'updated'
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.QA_SLACK_API_KEY }}
payload: |
channel: ${{ secrets.SLACK_TEAM_CORE_CHANNEL_ID}}
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:"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ DEPENDABOT_SEVERITY := "critical,high"
endif
dependabot: gomods
gh api --paginate -H "Accept: application/vnd.github+json" --method GET \
'/repos/smartcontractkit/chainlink-common/dependabot/alerts?state=open&ecosystem=Go&severity=$(DEPENDABOT_SEVERITY)' | \
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)"' | \
'/repos/smartcontractkit/chainlink-common/dependabot/alerts?state=open&ecosystem=Go&severity=$(DEPENDABOT_SEVERITY)' \
--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)"' | \
go run ./script/cmd/dependabot
gomods tidy
Loading