Skip to content

Commit f617a86

Browse files
authored
Merge pull request #3 from thedadams/consistent-test-ci
2 parents 5f384b3 + f7e45fc commit f617a86

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

.github/workflows/test.yaml

+30-4
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,43 @@ on:
55
- main
66
paths-ignore:
77
- README.md
8-
pull_request:
8+
pull_request_target:
9+
types:
10+
- labeled
11+
- unlabeled
912
branches:
1013
- main
1114
paths-ignore:
1215
- README.md
1316

1417
jobs:
18+
check-perms:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Get User Permission
22+
id: checkAccess
23+
uses: actions-cool/check-user-permission@v2
24+
with:
25+
require: write
26+
username: ${{ github.triggering_actor }}
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Check User Permission
30+
if: steps.checkAccess.outputs.require-result == 'false'
31+
run: |
32+
echo "${{ github.triggering_actor }} does not have permissions on this repo."
33+
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
34+
echo "Job originally triggered by ${{ github.actor }}"
35+
exit 1
36+
1537
test-linux:
38+
needs: check-perms
1639
runs-on: ubuntu-latest
1740
steps:
1841
- uses: actions/checkout@v4
1942
with:
2043
fetch-depth: 1
44+
ref: ${{ github.event.pull_request.head.sha }}
2145
- uses: actions/setup-go@v5
2246
with:
2347
cache: false
@@ -26,20 +50,22 @@ jobs:
2650
run: make validate
2751
- name: Install gptscript
2852
run: |
29-
curl https://get.gptscript.ai/releases/default_linux_amd64_v1/gptscript -o gptscript
30-
chmod +x gptscript
53+
curl https://get.gptscript.ai/releases/default_linux_amd64_v1/gptscript -o ./gptscriptexe
54+
chmod +x ./gptscriptexe
3155
- name: Run Tests
3256
env:
33-
GPTSCRIPT_BIN: ./gptscript
57+
GPTSCRIPT_BIN: ./gptscriptexe
3458
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3559
run: make test
3660

3761
test-windows:
62+
needs: check-perms
3863
runs-on: windows-latest
3964
steps:
4065
- uses: actions/checkout@v4
4166
with:
4267
fetch-depth: 1
68+
ref: ${{ github.event.pull_request.head.sha }}
4369
- uses: actions/setup-go@v5
4470
with:
4571
cache: false

0 commit comments

Comments
 (0)