Skip to content

Commit a21a0f3

Browse files
committed
ci: set workflow permissions
1 parent 45a1db0 commit a21a0f3

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

.github/workflows/test-release.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
name: Test & Release
22

33
on:
4-
workflow_dispatch:
54
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
610

711
concurrency:
812
group: ${{ github.workflow }}-${{ github.ref }}
913
cancel-in-progress: true
1014

15+
permissions:
16+
contents: write
17+
issues: write
18+
pull-requests: write
19+
1120
jobs:
1221
test:
1322
name: Test
1423
runs-on: ubuntu-latest
1524
env:
16-
GH_TOKEN: ${{ secrets.PROJECT_TOKEN }}
1725
PROJECT_NUMBER: 1
1826
PROJECT_OWNER: infinite-automations
1927
FIELD_NAME: Test select field
@@ -23,20 +31,26 @@ jobs:
2331
steps:
2432
- name: Checkout
2533
uses: actions/checkout@v4
34+
35+
- uses: actions/create-github-app-token@v1
36+
id: app-token
2637
with:
27-
show-progress: false
38+
app-id: ${{ vars.TESTING_APP_ID }}
39+
private-key: ${{ secrets.TESTING_APP_KEY }}
2840

2941
- name: Get field id precondition
3042
id: get-field-id-pre
3143
uses: infinite-automations/gh-projects-field-ids@v1.0.0
3244
with:
33-
token: ${{ secrets.PROJECT_TOKEN }}
45+
token: ${{ steps.app-token.outputs.token }}
3446
project-number: ${{ env.PROJECT_NUMBER }}
3547
project-owner: ${{ env.PROJECT_OWNER }}
3648
field-name: ${{ env.FIELD_NAME }}
3749
select-option-name: ${{ env.PRECONDITION_OPTION }}
3850

3951
- name: Setup test
52+
env:
53+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
4054
run: |
4155
gh project item-edit \
4256
--id ${{ env.ITEM_ID }} \
@@ -45,6 +59,8 @@ jobs:
4559
--single-select-option-id ${{ steps.get-field-id-pre.outputs.select-option-id }}
4660
4761
- name: Precondition
62+
env:
63+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
4864
run: |
4965
FIELD_KEY=$(echo "${{ env.FIELD_NAME }}" | tr '[:upper:]' '[:lower:]')
5066
FIELD_VAL=$(\
@@ -65,14 +81,16 @@ jobs:
6581
id: set-select-option-id
6682
uses: ./
6783
with:
68-
token: ${{ secrets.PROJECT_TOKEN }}
84+
token: ${{ steps.app-token.outputs.token }}
6985
project-number: 1
7086
project-owner: ${{ env.PROJECT_OWNER }}
7187
field-name: ${{ env.FIELD_NAME }}
7288
select-option-name: ${{ env.POSTCONDITION_OPTION }}
7389
item-id: ${{ env.ITEM_ID }}
7490

7591
- name: Postcondition
92+
env:
93+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
7694
run: |
7795
FIELD_KEY=$(echo "${{ env.FIELD_NAME }}" | tr '[:upper:]' '[:lower:]')
7896
FIELD_VAL=$(\

0 commit comments

Comments
 (0)