Skip to content

Commit 35a70b4

Browse files
authored
Add dispatch trigger & tests (#49)
* Add dispatch trigger & fix PEM creation * Fix base64 handling * Try another approach * Try another approach
1 parent 3ad1ee6 commit 35a70b4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
branches:
99
- main
10+
workflow_dispatch:
1011

1112
concurrency:
1213
group: ${{ github.ref }}-${{ github.workflow }}
@@ -35,7 +36,7 @@ jobs:
3536

3637
- name: Generate installation access token from PEM key file
3738
run: |
38-
echo "$APP_PRIVATE_KEY" > private_key.pem
39+
printf "%s" "$APP_PRIVATE_KEY" > private_key.pem
3940
./gh-token \
4041
generate \
4142
-i "$APP_ID" \
@@ -46,7 +47,7 @@ jobs:
4647

4748
- name: List installations for the app from PEM key file
4849
run: |
49-
echo "$APP_PRIVATE_KEY" > private_key.pem
50+
printf "%s" "$APP_PRIVATE_KEY" > private_key.pem
5051
./gh-token \
5152
installations \
5253
-i "$APP_ID" \
@@ -56,30 +57,28 @@ jobs:
5657
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
5758

5859
- name: Generate installation access token with base64 key
59-
continue-on-error: true
6060
run: |
6161
./gh-token \
6262
generate \
6363
-i "$APP_ID" \
64-
-b $(printf "%s" $APP_PRIVATE_KEY | base64) > /dev/null 2
64+
-b "$(echo "$APP_PRIVATE_KEY" | base64)" > /dev/null 2
6565
env:
6666
APP_ID: ${{ secrets.APP_ID }}
6767
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
6868

6969
- name: List installations for the app with base64 key
70-
continue-on-error: true
7170
run: |
7271
./gh-token \
7372
installations \
7473
-i "$APP_ID" \
75-
-b $(printf "%s" $APP_PRIVATE_KEY | base64) > /dev/null 2
74+
-b "$(echo "$APP_PRIVATE_KEY" | base64)" > /dev/null 2
7675
env:
7776
APP_ID: ${{ secrets.APP_ID }}
7877
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
7978

8079
- name: Generate then revoke token
8180
run: |
82-
echo "$APP_PRIVATE_KEY" > private_key.pem
81+
printf "%s" "$APP_PRIVATE_KEY" > private_key.pemm
8382
token="$(./gh-token generate -i $APP_ID -k private_key.pem | jq -r '.token')"
8483
./gh-token revoke -t $token
8584
env:

0 commit comments

Comments
 (0)