|
| 1 | +Prompt: |
| 2 | +The build failed on "Create GitHub Release". The error message is: |
| 3 | +Run softprops/action-gh-release@v2 |
| 4 | +👩🏭 Creating new GitHub release for tag v1.0.2... |
| 5 | +⚠️ GitHub release failed with status: 403 |
| 6 | +{"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/releases/releases#create-a-release","status":"403"} |
| 7 | +Skip retry — your GitHub token/PAT does not have the required permission to create a release |
| 8 | +⚠️ Unexpected error fetching GitHub release for tag refs/tags/v1.0.2: HttpError: Resource not accessible by integration - https://docs.github.com/rest/releases/releases#create-a-release |
| 9 | +Error: Resource not accessible by integration - https://docs.github.com/rest/releases/releases#create-a-release |
| 10 | + |
| 11 | +Response: |
| 12 | +Ah, the classic `403` permissions error! Don't worry, there is absolutely nothing wrong with your code or your build process. This is a built-in GitHub security feature stepping in. |
| 13 | + |
| 14 | +By default, GitHub gives the automated `GITHUB_TOKEN` "read-only" access to prevent workflows from accidentally modifying your repository. Because creating a Release involves writing new data (the release notes and the uploaded zip files) to your repo, GitHub blocked it. |
| 15 | + |
| 16 | +You can fix this in one of two ways. The first way (updating the YAML file) is the best practice. |
| 17 | + |
| 18 | +### Option 1: The Code Fix (Recommended) |
| 19 | + |
| 20 | +You just need to explicitly tell GitHub to grant this specific workflow "write" permissions for repository contents. |
| 21 | + |
| 22 | +Open your `build.yml` file and add the `permissions:` block right below your `on:` block, before the `jobs:` start. It should look exactly like this: |
| 23 | + |
| 24 | +```yaml |
| 25 | +name: Build and Release Pygame |
| 26 | + |
| 27 | +on: |
| 28 | + push: |
| 29 | + tags: |
| 30 | + - 'v*' |
| 31 | + workflow_dispatch: |
| 32 | + |
| 33 | +# --- ADD THIS NEW BLOCK --- |
| 34 | +permissions: |
| 35 | + contents: write |
| 36 | +# -------------------------- |
| 37 | + |
| 38 | +jobs: |
| 39 | + build: |
| 40 | + name: Build on ${{ matrix.os }} |
| 41 | +# ... (the rest of your file stays exactly the same) |
| 42 | + |
| 43 | +``` |
| 44 | + |
| 45 | +### Option 2: The Settings Fix (Alternative) |
| 46 | + |
| 47 | +If you'd rather change the default behavior for your entire repository so you don't have to add that block to your YAML files, you can do it through the GitHub website: |
| 48 | + |
| 49 | +1. Go to your repository on GitHub. |
| 50 | +2. Click on the **Settings** tab. |
| 51 | +3. On the left sidebar, scroll down to **Actions** and click **General**. |
| 52 | +4. Scroll down to the **Workflow permissions** section. |
| 53 | +5. Change the selection from "Read repository contents and packages permissions" to **"Read and write permissions"**. |
| 54 | +6. Click **Save**. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +### How to test the fix: |
| 59 | + |
| 60 | +Since the actual build phase succeeded previously and it only failed at the very end, you know your PyInstaller setup works! |
| 61 | + |
| 62 | +To trigger the release again, just bump your tag version, push it, and watch the magic happen: |
| 63 | + |
| 64 | +```bash |
| 65 | +git tag v1.0.3 |
| 66 | +git push origin v1.0.3 |
| 67 | + |
| 68 | +``` |
0 commit comments