Skip to content

Commit

Permalink
Update test.yml to use pull_request_target
Browse files Browse the repository at this point in the history
  • Loading branch information
arvvoid authored Dec 19, 2024
1 parent d0c8aff commit 736ec4e
Showing 1 changed file with 36 additions and 19 deletions.
55 changes: 36 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Test
on:
push:
branches: [ "main" ]
pull_request:
pull_request_target:
branches: [ "main" ]
schedule:
- cron: "0 0 1 * *" # Runs at 00:00 on the 1st day of every month
Expand All @@ -27,18 +27,27 @@ jobs:
FISKALHRGO_TEST_KNOWN_ZKI: ${{ secrets.FISKALHRGO_TEST_KNOWN_ZKI }}
CISTESTPRODPING: ${{ secrets.CISTESTPRODPING }}
steps:
- uses: actions/checkout@v4
- name: Checkout PR branch
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@v4
with:
# Check out the PR's head commit to test the contributor's changes
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Checkout default (non-PR)
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@v4

- name: Build
run: go build -v ./...
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'

- name: Test
run: go test -v ./...
- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

go122:
runs-on: ubuntu-latest
Expand All @@ -49,15 +58,23 @@ jobs:
FISKALHRGO_TEST_KNOWN_ZKI: ${{ secrets.FISKALHRGO_TEST_KNOWN_ZKI }}
CISTESTPRODPING: ${{ secrets.CISTESTPRODPING }}
steps:
- uses: actions/checkout@v4
- name: Checkout PR branch
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Checkout default (non-PR)
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@v4

- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Build
run: go build -v ./...
- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
- name: Test
run: go test -v ./...

0 comments on commit 736ec4e

Please sign in to comment.