Skip to content

Commit 8abaceb

Browse files
committed
fix: 🛂 apply permissions for gh pages upload
1 parent ae8e859 commit 8abaceb

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

ACTION_README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ on:
2525

2626
permissions:
2727
pull-requests: write
28+
contents: write # Required for GitHub Pages upload
2829

2930
jobs:
3031
coverage:
@@ -250,10 +251,36 @@ The action automatically uploads badges to your GitHub Pages branch when `upload
250251

251252
### Required Permissions
252253

253-
For automatic GitHub Pages upload, your workflow needs:
254+
For automatic GitHub Pages upload, your workflow MUST include these permissions:
255+
256+
```yaml
257+
permissions:
258+
pull-requests: write # For creating/updating PR comments
259+
contents: write # For uploading badges to GitHub Pages
260+
```
261+
262+
**Without `contents: write` permission, you'll see this error:**
263+
264+
```
265+
Warning: Failed to upload badges to GitHub Pages: Resource not accessible by integration
266+
```
267+
268+
### Troubleshooting
269+
270+
#### "Resource not accessible by integration" Error
271+
272+
This error occurs when the action doesn't have sufficient permissions to create git references or push to branches.
273+
274+
**Solution:** Add the required permissions to your workflow:
254275
255276
```yaml
256277
permissions:
257278
pull-requests: write
258-
contents: write # Required for uploading to GitHub Pages
279+
contents: write
259280
```
281+
282+
#### "Branch not found" Error
283+
284+
This error occurs when the action can't find the default branch to create the gh-pages branch from.
285+
286+
**Solution:** Make sure your repository has a default branch (usually `main` or `master`) and the action has `contents: write` permission.

0 commit comments

Comments
 (0)