-
Notifications
You must be signed in to change notification settings - Fork 442
54 lines (45 loc) · 1.58 KB
/
regenerate-target-info.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Regenerate target info
on:
workflow_dispatch: # Allow running on-demand
schedule:
- cron: '0 3 * * 5'
jobs:
regenerate:
name: Regenerate target info & Open Pull Request if necessary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: true
- name: Generate branch name
run: |
git checkout -b regenerate-target-info-${{ github.run_id }}
- name: Install rust
run: |
rustup toolchain install stable nightly --no-self-update --profile minimal
- name: Create lockfile
run: cargo update
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: 'true'
- name: Regenerate target info
run: cargo run -p gen-target-info
- name: Detect changes
id: changes
run:
# This output boolean tells us if the dependencies have actually changed
echo "count=$(git status --porcelain=v1 | wc -l)" >> $GITHUB_OUTPUT
- name: Commit and push changes
# Only push if changes exist
if: steps.changes.outputs.count > 0
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git commit -am "Regenerate target info"
git push origin HEAD
- name: Open pull request if needed
if: steps.changes.outputs.count > 0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --base main --title "Update src/target_info.rs" --body "Automatically regenerated in CI"