Skip to content

Commit d3b0b40

Browse files
committed
CI: Add check-version-bump
1 parent c8a14e0 commit d3b0b40

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Auto Reviewer
2+
3+
on:
4+
pull_request:
5+
types: [opened, labeled]
6+
7+
jobs:
8+
auto-reviewer:
9+
runs-on: ubuntu-latest
10+
if: contains(github.event.pull_request.labels.*.name, 'dependencies')
11+
permissions:
12+
pull-requests: write
13+
14+
steps:
15+
- name: Add reviewers for Github Actions dependencies
16+
if: contains(github.event.pull_request.labels.*.name, 'github_actions')
17+
uses: actions/github-script@v8
18+
with:
19+
script: |
20+
await github.rest.pulls.requestReviewers({
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
pull_number: context.issue.number,
24+
reviewers: ['fvacek', 'syyyr']
25+
});
26+
27+
- name: Add reviewers for Rust dependencies
28+
if: contains(github.event.pull_request.labels.*.name, 'rust')
29+
uses: actions/github-script@v8
30+
with:
31+
script: |
32+
await github.rest.pulls.requestReviewers({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
pull_number: context.issue.number,
36+
reviewers: ['fvacek', 'j4r0u53k', 'syyyr']
37+
});
38+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# vim: sw=2
2+
name: Misc
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6+
cancel-in-progress: true
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
pull_request:
12+
branches: [ "main" ]
13+
14+
permissions:
15+
contents: write
16+
pull-requests: read
17+
18+
jobs:
19+
check-version-bump:
20+
name: Check version bump
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v5
25+
- name: Check version bump
26+
id: version-check
27+
continue-on-error: ${{startsWith(github.head_ref, 'dependabot/')}}
28+
uses: silicon-heaven/rust-check-version-bump@v1.0.1
29+
30+
- name: Check if Cargo.lock was changed
31+
continue-on-error: ${{startsWith(github.head_ref, 'dependabot/')}}
32+
run: |
33+
cargo update --workspace
34+
if ! git diff --exit-code; then
35+
echo "Error: No version bump detected in Cargo.lock"
36+
exit 1
37+
fi
38+
39+
- name: Fetch Dependabot metadata
40+
id: dependabot-metadata
41+
if: steps.version-check.outcome == 'failure'
42+
uses: dependabot/fetch-metadata@v2
43+
with:
44+
github-token: ${{secrets.GITHUB_TOKEN}}
45+
46+
- name: Checkout code
47+
if: steps.version-check.outcome == 'failure'
48+
uses: actions/checkout@v5
49+
with:
50+
fetch-depth: 0
51+
ref: ${{github.head_ref}}
52+
53+
- name: Bump version
54+
if: steps.version-check.outcome == 'failure'
55+
run: |
56+
echo "Bumping version by patch"
57+
cargo install cargo-bump
58+
cargo bump patch
59+
cargo update --workspace
60+
61+
- name: Commit changes
62+
if: steps.version-check.outcome == 'failure'
63+
run: |
64+
git diff
65+
git config --global user.name "Login will be determined by the Github API based on the creator of the token"
66+
git config --global user.email ""
67+
git commit -am '[dependabot-skip] Bump version'
68+
69+
- name: Push changes
70+
if: steps.version-check.outcome == 'failure'
71+
uses: Asana/push-signed-commits@v1
72+
with:
73+
github-token: ${{secrets.DEPENDABOT_GITHUB_TOKEN}}
74+
local_branch_name: ${{github.head_ref}}
75+
remote_branch_name: ${{github.head_ref}}

0 commit comments

Comments
 (0)