Skip to content

Commit b413543

Browse files
committed
conditionally set environment variable
1 parent 334eed1 commit b413543

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,22 @@ env:
2323
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-dev"
2424

2525
jobs:
26+
27+
set-vars:
28+
name: Set Variables
29+
runs-on: ubuntu-22.04
30+
if: ${{ github.event.pull_request.head.repo.fork }}
31+
output:
32+
goproxy: ${{ steps.set-vars.outputs.goproxy }}
33+
steps:
34+
- name: Set Variables
35+
run: |
36+
echo "GOPROXY=direct" >> $GITHUB_ENV
2637
lint:
2738
name: Lint
2839
runs-on: ubuntu-22.04
40+
env:
41+
GOPROXY: ${{ needs.set-vars.outputs.goproxy || env.GOPROXY }}
2942
steps:
3043
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3144
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@@ -39,6 +52,8 @@ jobs:
3952
unit-test:
4053
name: Unit Tests
4154
runs-on: ubuntu-22.04
55+
env:
56+
GOPROXY: ${{ needs.set-vars.outputs.goproxy || env.GOPROXY }}
4257
steps:
4358
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4459
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@@ -58,6 +73,8 @@ jobs:
5873
race-condition-test:
5974
name: Unit tests with race condition detection
6075
runs-on: ubuntu-22.04
76+
env:
77+
GOPROXY: ${{ needs.set-vars.outputs.goproxy || env.GOPROXY }}
6178
steps:
6279
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
6380
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@@ -69,6 +86,8 @@ jobs:
6986
build-unsigned-snapshot:
7087
name: Build Unsigned Snapshot
7188
runs-on: ubuntu-22.04
89+
env:
90+
GOPROXY: ${{ needs.set-vars.outputs.goproxy || env.GOPROXY }}
7291
steps:
7392
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
7493
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@@ -91,6 +110,8 @@ jobs:
91110
name: Integration Tests
92111
needs: build-unsigned-snapshot
93112
runs-on: ubuntu-22.04
113+
env:
114+
GOPROXY: ${{ needs.set-vars.outputs.goproxy || env.GOPROXY }}
94115
strategy:
95116
matrix:
96117
container:
@@ -212,6 +233,8 @@ jobs:
212233
performance-tests:
213234
name: Performance Tests
214235
runs-on: ubuntu-22.04
236+
env:
237+
GOPROXY: ${{ needs.set-vars.outputs.goproxy || env.GOPROXY }}
215238
permissions:
216239
contents: write
217240
steps:

0 commit comments

Comments
 (0)