mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-19 20:57:53 +02:00
docs: add github actions error when no pat
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
e8c8a2832f
commit
8c06005bc6
76
www/docs/errors/resource-not-accessible-by-integration.md
Normal file
76
www/docs/errors/resource-not-accessible-by-integration.md
Normal file
@ -0,0 +1,76 @@
|
||||
# Resource not accessible by integration
|
||||
|
||||
When using GitHub Actions, you might feel tempted to use the action-bound `GITHUB_TOKEN`.
|
||||
|
||||
While it is a good practice, and should work for most cases, if your workflow writes a file in another repository, you may see this error:
|
||||
|
||||
```sh
|
||||
⨯ release failed after 430.85s error=homebrew tap formula: failed to publish artifacts: PUT https://api.github.com/repos/user/homebrew-tap/contents/Formula/scorecard.rb: 403 Resource not accessible by integration []
|
||||
```
|
||||
|
||||
Integrations that may cause this:
|
||||
|
||||
- Homebrew Tap
|
||||
- Gofish Rigs
|
||||
- Krew Plugins
|
||||
|
||||
## Fixing it
|
||||
|
||||
You have basically two options:
|
||||
|
||||
### 1. Use a Personal Access Token (PAT) for the entire process
|
||||
|
||||
You can create a PAT and use it for the entire GoReleaser action run.
|
||||
You'll need to add it as secret and pass it to the action, for instance:
|
||||
|
||||
```yaml
|
||||
# .github/workflows/goreleaser.yml
|
||||
# ...
|
||||
- uses: goreleaser/goreleaser-action@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||
# ...
|
||||
```
|
||||
|
||||
### 2. Use a Personal Access Token (PAT) specifically for the integration
|
||||
|
||||
You can also create a PAT for each integration.
|
||||
|
||||
Let's see, for example, how it would look like for Homebrew Taps.
|
||||
|
||||
We would need to change the workflow file:
|
||||
|
||||
```yaml
|
||||
# .github/workflows/goreleaser.yml
|
||||
# ...
|
||||
- uses: goreleaser/goreleaser-action@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
|
||||
# ...
|
||||
```
|
||||
|
||||
And also the `.goreleaser.yaml` file:
|
||||
|
||||
```yaml
|
||||
# .goreleaser.yaml
|
||||
# ...
|
||||
brews:
|
||||
- name: myproject
|
||||
tap:
|
||||
owner: user
|
||||
name: homebrew-tap
|
||||
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
|
||||
# ...
|
||||
```
|
||||
|
||||
## Learning more
|
||||
|
||||
Read the documentation for each topic:
|
||||
|
||||
- [GitHub](/scm/github/)
|
||||
- [GitHub Actions](/ci/actions/)
|
||||
- [Homebrew Tap](/customization/homebrew/)
|
||||
- [Gofish Rigs](/customization/gofish/)
|
||||
- [Krew Plugin Manifests](/customization/krew/)
|
||||
- [Scoop Manifests](/customization/scoop/)
|
@ -133,6 +133,7 @@ nav:
|
||||
- errors/dirty.md
|
||||
- errors/multiple-tokens.md
|
||||
- errors/no-main.md
|
||||
- errors/resource-not-accessible-by-integration.md
|
||||
- deprecations.md
|
||||
- Cookbooks:
|
||||
- About: cookbooks/index.md
|
||||
|
Loading…
x
Reference in New Issue
Block a user