ci(test): run on pull request and add concurrency configuration (#17)

- Run test on pull requests to the main branch instead of on every push
- Cancel in-progress workflows if a PR is updated (i.e., a new commit is
pushed) and the same workflows are triggered to run again
- Rename step ID from `demo` to `test`

---------

Co-authored-by: Gregor Martynus <[email protected]>
This commit is contained in:
Parker Brown
2023-08-24 15:30:49 -07:00
committed by GitHub
co-authored by Gregor Martynus
parent 27ab48741c
commit 4fd0ce7c29
+8 -3
View File
@@ -1,5 +1,10 @@
name: test name: test
on: [push] on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
test: test:
@@ -13,14 +18,14 @@ jobs:
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- uses: ./ # Uses the action in the root directory - uses: ./ # Uses the action in the root directory
id: demo id: test
with: with:
app_id: ${{ vars.TEST_APP_ID }} app_id: ${{ vars.TEST_APP_ID }}
private_key: ${{ secrets.TEST_APP_PRIVATE_KEY }} private_key: ${{ secrets.TEST_APP_PRIVATE_KEY }}
- uses: octokit/[email protected] - uses: octokit/[email protected]
id: get-repository id: get-repository
env: env:
GITHUB_TOKEN: ${{ steps.demo.outputs.token }} GITHUB_TOKEN: ${{ steps.test.outputs.token }}
with: with:
route: GET /installation/repositories route: GET /installation/repositories
- run: echo '${{ steps.get-repository.outputs.data }}' - run: echo '${{ steps.get-repository.outputs.data }}'