diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 160debc03..d9b5d8cc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: - dev - ci-* schedule: - - cron: '0 0,3,6,9,12,15,18,21 * * *' + - cron: '0 0 * * *' workflow_dispatch: env: @@ -232,49 +232,3 @@ jobs: shell: sh # TODO: OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH: unknown if: (!startsWith(matrix.container, 'opensuse')) - - 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') diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml new file mode 100644 index 000000000..301a2411c --- /dev/null +++ b/.github/workflows/manifest.yml @@ -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')