Skip to content

Commit

Permalink
Add functionality to configure access to internal and private reposit…
Browse files Browse the repository at this point in the history
…ories (#55)

* Add functionality to configure access to internal and private repositories. Uses optional secret to pass the token.
  • Loading branch information
skasti authored Nov 27, 2024
1 parent 0a52628 commit cfec6c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/release-drafter-go.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
on:
workflow_call:
secrets:
GITHUB_OAUTH_TOKEN:
required: false
inputs:
config-name:
type: string
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,18 @@ 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
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
Expand Down

0 comments on commit cfec6c7

Please sign in to comment.