From 89d48b28f0918e508c0f63399b5f079bd1de6c5c Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 4 May 2024 23:55:55 +1000 Subject: [PATCH 1/2] CI: Create regenerate-target-info For automatically regenerate target_info.rs --- .github/workflows/regenerate-target-info | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/regenerate-target-info diff --git a/.github/workflows/regenerate-target-info b/.github/workflows/regenerate-target-info new file mode 100644 index 00000000..76ed161c --- /dev/null +++ b/.github/workflows/regenerate-target-info @@ -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 From 67eae7c3fae5cd42cd2153683514f52bf6d942b1 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 4 May 2024 23:57:11 +1000 Subject: [PATCH 2/2] Update step for generating branch name in regenerate-target-info --- .github/workflows/regenerate-target-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regenerate-target-info b/.github/workflows/regenerate-target-info index 76ed161c..3da572b6 100644 --- a/.github/workflows/regenerate-target-info +++ b/.github/workflows/regenerate-target-info @@ -16,7 +16,7 @@ jobs: - name: Generate branch name run: | - git checkout -b deps/regenerate-target-info/${{ github.run_id }} + git checkout -b regenerate-target-info/${{ github.run_id }} - name: Install rust run: |