Skip to content

Commit

Permalink
Using bot in the build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
CatChen committed Jun 14, 2024
1 parent cd3fccd commit b6ef172
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,36 @@ on:
jobs:
build:
name: Build
if: ${{ !startsWith(github.head_ref, 'workflows/tests/') }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/create-github-app-token@v1
id: get-github-app-token
with:
app-id: ${{ secrets.CHECK_GIT_STATUS_BOT_APP_ID }}
private-key: ${{ secrets.CHECK_GIT_STATUS_BOT_APP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ inputs.ref || github.head_ref }}
token: ${{ steps.get-github-app-token.outputs.token }}

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
check-latest: true
cache: yarn

- name: Install dependencies
run: yarn

- name: Lint
run: yarn lint --fix

- name: Build
run: yarn build

Expand All @@ -45,5 +57,5 @@ jobs:
with:
fail-if-not-clean: ${{ github.actor != 'dependabot[bot]' || github.actor_id != 49699333 }}
push-if-not-clean: true
push-token: ${{ secrets.CHECK_GIT_STATUS_ACTION_TOKEN }}
request-changes-token: ${{ secrets.GITHUB_TOKEN }}
request-changes-if-not-clean: false
push-token: ${{ steps.get-github-app-token.outputs.token }}
24 changes: 12 additions & 12 deletions .github/workflows/ship.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ concurrency:
group: |-
${{
github.event.pull_request.number ||
join(github.event.check_run.pull_requests.*.number, ', ') ||
join(github.event.check_suite.pull_requests.*.number, ', ') ||
join(github.event.workflow_run.pull_requests.*.number, ', ') ||
github.event.check_run.pull_requests[0].number ||
github.event.check_suite.pull_requests[0].number ||
github.event.workflow_run.pull_requests[0].number ||
github.sha ||
github.ref
}}
Expand All @@ -46,9 +46,9 @@ jobs:
CONCURRENCY_GROUP: |-
${{
github.event.pull_request.number ||
join(github.event.check_run.pull_requests.*.number, ', ') ||
join(github.event.check_suite.pull_requests.*.number, ', ') ||
join(github.event.workflow_run.pull_requests.*.number, ', ') ||
github.event.check_run.pull_requests[0].number ||
github.event.check_suite.pull_requests[0].number ||
github.event.workflow_run.pull_requests[0].number ||
github.sha ||
github.ref
}}
Expand All @@ -61,9 +61,9 @@ jobs:
${{
github.base_ref == 'main' ||
github.event.pull_request.base.ref == 'main' ||
contains(github.event.check_run.pull_requests.*.base.ref, 'main') ||
contains(github.event.check_suite.pull_requests.*.base.ref, 'main') ||
contains(github.event.workflow_run.pull_requests.*.base.ref, 'main')
contains(github.event.check_run.pull_requests[0].base.ref, 'main') ||
contains(github.event.check_suite.pull_requests[0].base.ref, 'main') ||
contains(github.event.workflow_run.pull_requests[0].base.ref, 'main')
}}
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -93,9 +93,9 @@ jobs:
${{
github.base_ref == 'main' ||
github.event.pull_request.base.ref == 'main' ||
contains(github.event.check_run.pull_requests.*.base.ref, 'main') ||
contains(github.event.check_suite.pull_requests.*.base.ref, 'main') ||
contains(github.event.workflow_run.pull_requests.*.base.ref, 'main')
contains(github.event.check_run.pull_requests[0].base.ref, 'main') ||
contains(github.event.check_suite.pull_requests[0].base.ref, 'main') ||
contains(github.event.workflow_run.pull_requests[0].base.ref, 'main')
}}
runs-on: ubuntu-latest
permissions:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ concurrency:
group: |-
${{
github.event.pull_request.number ||
join(github.event.check_run.pull_requests.*.number, ', ') ||
join(github.event.check_suite.pull_requests.*.number, ', ') ||
join(github.event.workflow_run.pull_requests.*.number, ', ') ||
join(github.event.check_run.pull_requests[0].number, ', ') ||
join(github.event.check_suite.pull_requests[0].number, ', ') ||
join(github.event.workflow_run.pull_requests[0].number, ', ') ||
github.sha ||
github.ref
}}
Expand All @@ -27,9 +27,9 @@ jobs:
CONCURRENCY_GROUP: |-
${{
github.event.pull_request.number ||
join(github.event.check_run.pull_requests.*.number, ', ') ||
join(github.event.check_suite.pull_requests.*.number, ', ') ||
join(github.event.workflow_run.pull_requests.*.number, ', ') ||
join(github.event.check_run.pull_requests[0].number, ', ') ||
join(github.event.check_suite.pull_requests[0].number, ', ') ||
join(github.event.workflow_run.pull_requests[0].number, ', ') ||
github.sha ||
github.ref
}}
Expand Down

0 comments on commit b6ef172

Please sign in to comment.