Skip to content

Update test.yml to use pull_request_target #38

Update test.yml to use pull_request_target

Update test.yml to use pull_request_target #38

Workflow file for this run

name: Test
on:
push:
branches: [ "main" ]
pull_request_target:
branches: [ "main" ]
schedule:
- cron: "0 0 1 * *" # Runs at 00:00 on the 1st day of every month
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [amd64, arm64, 386]
exclude:
- os: windows-latest
arch: arm64
- os: macos-latest
arch: 386
env:
CIS_P12_BASE64: ${{ secrets.CIS_P12_BASE64 }}
FISKALHRGO_TEST_CERT_PASSWORD: ${{ secrets.FISKALHRGO_TEST_CERT_PASSWORD }}
FISKALHRGO_TEST_CERT_OIB: ${{ secrets.FISKALHRGO_TEST_CERT_OIB }}
FISKALHRGO_TEST_KNOWN_ZKI: ${{ secrets.FISKALHRGO_TEST_KNOWN_ZKI }}
CISTESTPRODPING: ${{ secrets.CISTESTPRODPING }}
steps:
- 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: Checkout default (non-PR)
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
go122:
runs-on: ubuntu-latest
env:
CIS_P12_BASE64: ${{ secrets.CIS_P12_BASE64 }}
FISKALHRGO_TEST_CERT_PASSWORD: ${{ secrets.FISKALHRGO_TEST_CERT_PASSWORD }}
FISKALHRGO_TEST_CERT_OIB: ${{ secrets.FISKALHRGO_TEST_CERT_OIB }}
FISKALHRGO_TEST_KNOWN_ZKI: ${{ secrets.FISKALHRGO_TEST_KNOWN_ZKI }}
CISTESTPRODPING: ${{ secrets.CISTESTPRODPING }}
steps:
- 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: Build
run: go build -v ./...
- name: Test
run: go test -v ./...