-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Move manifest job to its own workflow to reduce needless test runs
- Loading branch information
Showing
2 changed files
with
80 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Manifest | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
- ci-* | ||
schedule: | ||
- cron: '0 0,3,6,9,12,15,18,21 * * *' | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_GIT_FETCH_WITH_CLI: true | ||
CARGO_NET_RETRY: 10 | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: 1 | ||
RUSTFLAGS: -D warnings | ||
RUSTUP_MAX_RETRIES: 10 | ||
|
||
defaults: | ||
run: | ||
shell: bash --noprofile --norc -CeEuxo pipefail {0} | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
manifest: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
permissions: | ||
contents: read | ||
pull-requests: write # for gh pr review --approve | ||
steps: | ||
- uses: taiki-e/checkout-action@v1 | ||
- uses: taiki-e/github-actions/install-rust@stable | ||
- name: Generate Cargo.lock | ||
run: cargo update | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-all-crates: 'true' | ||
- run: tools/manifest.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Handle diff | ||
id: diff | ||
run: tools/ci/manifest.sh | ||
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') | ||
- run: git add -N . && git diff --exit-code | ||
- id: create-pull-request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
title: Update manifest | ||
body: | | ||
Auto-generated by CI using [create-pull-request](https://github.com/peter-evans/create-pull-request). | ||
This will be auto-merged when CI has passed because this is an auto-generated PR in a defined format and is usually considered no additional review is required. | ||
branch: update-manifest | ||
token: ${{ secrets.CREATE_PR_TOKEN }} | ||
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' | ||
- name: Enable auto-merge for auto-generated PR | ||
run: gh pr merge --rebase --auto "${PR_NUMBER:?}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.CREATE_PR_TOKEN }} | ||
PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }} | ||
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' && steps.create-pull-request.outputs.pull-request-operation == 'created' | ||
- name: Approve auto-generated PR for auto-merge | ||
run: gh pr review --approve "${PR_NUMBER:?}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }} | ||
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' && (steps.create-pull-request.outputs.pull-request-operation == 'created' || steps.create-pull-request.outputs.pull-request-operation == 'updated') |