Skip to content
Draft
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
35 changes: 35 additions & 0 deletions .github/workflows/dependabot-post-steps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run custom steps on Dependabot PRs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you may need to add permissions:

permissions:
  pull-requests: write
  contents: write

(maybe contents isn't needed?)


on:
pull_request:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also ad filter when changes are touching the lock file? As there's no need for go updates

types: [opened, synchronize]
branches:
- main

jobs:
amend-dependabot-commit:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-24.04

steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Use Cargo lock file version 3
run: |
# This is a workaround for the issue that dependabot updates the
# Cargo.lock file to version 4, which is not available in Noble.
cargo generate-lockfile

- name: Amend commit and push
run: |
if git diff --quiet; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be explicit on file?

Suggested change
if git diff --quiet; then
if git diff --quiet -- "**Cargo.lock"; then

echo "No changes to commit."
exit 0
fi

git add -A
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
git add -A
git add "**Cargo.lock"

git commit --amend --no-edit
git push --force
Loading