Skip to content

Commit

Permalink
CI: Create regenerate-target-info
Browse files Browse the repository at this point in the history
For automatically regenerate target_info.rs
  • Loading branch information
NobodyXu committed May 4, 2024
1 parent 2c85112 commit 89d48b2
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/regenerate-target-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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 deps/regenerate-target-info/${{ github.run_id }}

- name: Install rust
run: |
rustup toolchain install stable --no-self-update --profile minimal

- name: Regenerate target info
run: cargo run --bin 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 "dep: 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 --fill

0 comments on commit 89d48b2

Please sign in to comment.