Skip to content

Commit ff7ed68

Browse files
authored
fix: add GOPRIVATE and git config for private module access (#46)
## Summary - Add `GOPRIVATE=github.com/conductorone/*` env var to lint and test jobs - Add optional `RELENG_GITHUB_TOKEN` secret for authenticating to private repos - Configure git credentials only when token is provided ## Problem golangci-lint fails on baton-http based connectors because it can't access the private `baton-http` module during type checking: ``` could not import github.com/conductorone/baton-http/pkg/bconfig fatal: could not read Username for 'https://github.com': terminal prompts disabled ``` ## Solution Callers explicitly pass `RELENG_GITHUB_TOKEN` secret, which is used to configure git credentials for private module access. ## Affected repos (36 total) All connectors using `template: baton-http-template` ## Tested - ✅ baton-sagehr PR #61 - both lint and test pass with this fix ## Caller workflow change required Callers need to pass `RELENG_GITHUB_TOKEN`: ```yaml jobs: verify: uses: ConductorOne/github-workflows/.github/workflows/verify.yaml@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} secrets: RELENG_GITHUB_TOKEN: ${{ secrets.RELENG_GITHUB_TOKEN }} ```
1 parent baa0422 commit ff7ed68

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/verify.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ on:
88
required: false
99
type: boolean
1010
default: true
11+
secrets:
12+
RELENG_GITHUB_TOKEN:
13+
required: false
1114
jobs:
1215
lint:
1316
runs-on: ubuntu-latest
17+
env:
18+
GOPRIVATE: github.com/conductorone/*
1419
steps:
1520
- name: Checkout caller repo
1621
uses: actions/checkout@v5
@@ -19,6 +24,13 @@ jobs:
1924
repository: ${{ github.event.repository.full_name }}
2025
fetch-depth: 0
2126
ref: ${{ inputs.ref }}
27+
- name: Configure git for private modules
28+
env:
29+
TOKEN: ${{ secrets.RELENG_GITHUB_TOKEN }}
30+
run: |
31+
if [ -n "$TOKEN" ]; then
32+
git config --global url."https://${TOKEN}@github.com/".insteadOf "https://github.com/"
33+
fi
2234
- name: Install Go
2335
uses: actions/setup-go@v5
2436
with:
@@ -35,13 +47,22 @@ jobs:
3547
matrix:
3648
platform: [ubuntu-latest]
3749
runs-on: ${{ matrix.platform }}
50+
env:
51+
GOPRIVATE: github.com/conductorone/*
3852
steps:
3953
- name: Checkout caller repo
4054
uses: actions/checkout@v5
4155
with:
4256
repository: ${{ github.event.repository.full_name }}
4357
fetch-depth: 0
4458
ref: ${{ inputs.ref }}
59+
- name: Configure git for private modules
60+
env:
61+
TOKEN: ${{ secrets.RELENG_GITHUB_TOKEN }}
62+
run: |
63+
if [ -n "$TOKEN" ]; then
64+
git config --global url."https://${TOKEN}@github.com/".insteadOf "https://github.com/"
65+
fi
4566
- name: Install Go
4667
uses: actions/setup-go@v5
4768
with:
@@ -53,4 +74,3 @@ jobs:
5374
uses: guyarb/golang-test-annotations@v0.8.0
5475
with:
5576
test-results: test.json
56-

0 commit comments

Comments
 (0)