Skip to content

Commit

Permalink
ci: move dependabot updating process to Gtihub Actions (solana-labs#1466
Browse files Browse the repository at this point in the history
)

* add dependabot-pr Github Actions

* move updating dependabot pr process to Github Actions

* update user.email and user.name to dependabot itself

* only add for cargo.lock

* don't push anything if nothing to update
  • Loading branch information
yihau authored May 27, 2024
1 parent a4a009e commit ff21dbe
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 83 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/dependabot-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Dependabot PR

on:
pull_request:
branches:
- master

jobs:
dependabot:
timeout-minutes: 10
runs-on: ubuntu-latest
if: github.triggering_actor == 'dependabot[bot]'
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.PAT }}

- name: update code
run: |
input="${{ github.event.pull_request.title }}"
regex="[Bb]ump (.*) from (.*) to (.*)"
if [[ ! "$input" =~ $regex ]]; then
echo "unexpected pattern"
exit 1
fi
crate_name="${BASH_REMATCH[1]}"
old_version="${BASH_REMATCH[2]}"
new_version="${BASH_REMATCH[3]}"
echo "crate_name: $crate_name, old_version: $old_version, new_version: $new_version"
./scripts/cargo-for-all-lock-files.sh -- update -p $crate_name:$old_version --precise $new_version
./scripts/cargo-for-all-lock-files.sh -- tree
- name: push
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "✅ Nothing to update"
else
git config user.email "49699333+dependabot[bot]@users.noreply.github.com"
git config user.name "dependabot[bot]"
git add **/Cargo.lock
git commit -am "update all Cargo files"
git push
fi
4 changes: 0 additions & 4 deletions ci/buildkite-pipeline-in-disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ if [[ $BUILDKITE_BRANCH =~ ^pull ]]; then
annotate --style info --context pr-backlink \
"Github Pull Request: https://github.com/anza-xyz/agave/$BUILDKITE_BRANCH"

if [[ $GITHUB_USER = "dependabot[bot]" ]]; then
command_step dependabot "ci/dependabot-pr.sh" 5
wait_step
fi
pull_or_push_steps
exit 0
fi
Expand Down
4 changes: 0 additions & 4 deletions ci/buildkite-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,6 @@ if [[ $BUILDKITE_BRANCH =~ ^pull ]]; then
annotate --style info --context pr-backlink \
"Github Pull Request: https://github.com/anza-xyz/agave/$BUILDKITE_BRANCH"

if [[ $GITHUB_USER = "dependabot[bot]" ]]; then
command_step dependabot "ci/dependabot-pr.sh" 5
wait_step
fi
pull_or_push_steps
exit 0
fi
Expand Down
4 changes: 0 additions & 4 deletions ci/buildkite-solana-private.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@ if [[ $BUILDKITE_BRANCH =~ ^pull ]]; then
annotate --style info --context pr-backlink \
"Github Pull Request: https://github.com/anza-xyz/agave/$BUILDKITE_BRANCH"

if [[ $GITHUB_USER = "dependabot[bot]" ]]; then
command_step dependabot "ci/dependabot-pr.sh" 5
wait_step
fi
pull_or_push_steps
exit 0
fi
Expand Down
36 changes: 0 additions & 36 deletions ci/dependabot-pr.sh

This file was deleted.

35 changes: 0 additions & 35 deletions ci/dependabot-updater.sh

This file was deleted.

0 comments on commit ff21dbe

Please sign in to comment.