diff --git a/.github/workflows/release-drafter-go.yaml b/.github/workflows/release-drafter-go.yaml index 4d46b18..3be11a7 100644 --- a/.github/workflows/release-drafter-go.yaml +++ b/.github/workflows/release-drafter-go.yaml @@ -1,5 +1,8 @@ on: workflow_call: + secrets: + GITHUB_OAUTH_TOKEN: + required: false inputs: config-name: type: string @@ -77,6 +80,13 @@ jobs: - uses: actions/setup-go@v5.0.2 with: go-version-file: "${{ inputs.project-path }}/go.mod" + - name: Configure access to internal and private GitHub repos + run: | + if [ -n "${{ secrets.GITHUB_OAUTH_TOKEN }}" ]; then + git config --global url."https://${{ secrets.GITHUB_OAUTH_TOKEN }}:x-oauth-basic@github.com/coopnorge".insteadOf "https://github.com/coopnorge"; + else + echo "GITHUB_OAUTH_TOKEN is not set. Skipping Git configuration."; + fi - name: Install API DIff run: go install golang.org/x/exp/cmd/apidiff@latest - name: Get PR diff diff --git a/docs/index.md b/docs/index.md index 335acd3..ebea756 100644 --- a/docs/index.md +++ b/docs/index.md @@ -57,6 +57,8 @@ jobs: uses: coopnorge/github-workflow-release-drafter/.github/workflows/release-drafter-go.yaml@v0.1.0 with: project-path: "./go-playground" + secrets: + GITHUB_OAUTH_TOKEN: ${{ secrets.OUR_GITHUB_TOKEN }} ``` **NOTE:** As we generally have projects inside subdirectories, we need to @@ -64,6 +66,9 @@ specify the `project-path`. **NOTE:** Make sure to request permissions +**NOTE:** GITHUB_OAUTH_TOKEN should be supplied if you reference other +internal/private repositories + ```yaml pull-requests: write contents: write