CI #2278
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
name: CI | |
permissions: | |
contents: read | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- dev | |
schedule: | |
- cron: '0 0,6,12,18 * * *' | |
workflow_dispatch: | |
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: | |
tidy: | |
uses: taiki-e/github-actions/.github/workflows/tidy.yml@main | |
permissions: | |
contents: read | |
pull-requests: write # for gh pr edit --add-assignee | |
repository-projects: read # for gh pr edit --add-assignee | |
secrets: inherit | |
# TODO: test on CI | |
bucket: | |
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 | |
- run: tools/bucket.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: diff | |
run: tools/ci/bucket.sh | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') | |
- id: create-pull-request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
title: Update bucket | |
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-bucket | |
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: Auto approve for auto-generated PR | |
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') | |
- run: git add -N . && git diff --exit-code |