Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

Summary

This PR fixes the auto-release workflow job that was failing with "Resource not accessible by integration" error by:

  1. Updated workflow permissions: Added required permissions to the top-level permissions block:

    • packages: write - for publishing packages
    • issues: read - for reading issue information
    • pull-requests: read - for reading PR information
    • actions: read - for reading workflow information
  2. Replaced third-party action with GitHub-maintained actions: Replaced marvinpinto/action-automatic-releases@latest with:

    • actions/create-release@v1 - for creating the "latest" prerelease
    • actions/upload-release-asset@v1 - for uploading JAR artifacts
    • Added step to delete existing "latest" release before creating a new one using gh release delete
  3. Dynamic JAR discovery: Added steps to dynamically find built JAR files using wildcards and expose their paths via outputs

  4. Graceful artifact handling: Conditionally upload assets only if JAR files are found, preventing upload failures for missing artifacts

  5. Proper asset naming: Assets are now named with DATE and COUNT (e.g., NetworkDataAPI-Paper-2025.11.04-123.jar)

Changes Made

  • Updated .github/workflows/build-and-release.yml:
    • Modified permissions block (lines 15-20)
    • Replaced auto-release job implementation (lines 133-222)
    • Kept all other jobs (build, release) unchanged

References

Testing

The workflow will be automatically tested when merged to main/master branch.

Original prompt

The repository's GitHub Actions workflow .github/workflows/build-and-release.yml currently fails in the auto-release job with "Resource not accessible by integration" when using marvinpinto/action-automatic-releases. Create a pull request that implements the following changes to reliably create the automatic "latest" prerelease using GitHub-maintained actions and appropriate workflow permissions.

References:

Required changes:

  1. Update the top-level permissions block to grant the workflow the needed permissions for creating releases and uploading assets. Replace the current block with:

permissions:
contents: write
packages: write
issues: read
pull-requests: read
actions: read

  1. Replace the auto-release job's use of marvinpinto/action-automatic-releases@latest with an implementation that uses actions/create-release@v1 and actions/upload-release-asset@v1. The new auto-release job should:
  • Keep needs: build, runs-on: ubuntu-latest, and the existing if condition to run only on main/master pushes.
  • Continue to checkout with fetch-depth: 0.
  • Build with Maven as before.
  • Calculate DATE and COUNT outputs as in the original job.
  • Create or update a "latest" prerelease via actions/create-release@v1 using GITHUB_TOKEN and set prerelease: true.
  • Find the built JAR artifacts dynamically (wildcard) and expose their paths via outputs.
  • Conditionally upload each artifact (Paper and Bungee) to the release using actions/upload-release-asset@v1, naming the assets with the DATE and COUNT (e.g., NetworkDataAPI-Paper-${{ steps.date.outputs.DATE }}-${{ steps.commit_count.outputs.COUNT }}.jar).

Include the exact replacement YAML for the auto-release job steps. The job must gracefully handle missing artifact files (skip upload if not found).

  1. Commit the changes on a new branch named fix/auto-release-permissions-and-action and open a pull request against the default branch with a clear title and description summarizing the fix and referencing the failing job ID.

Make sure the PR uses the repository's GITHUB_TOKEN (no PAT) and does not introduce any secrets. Keep all other jobs unchanged.

Files to modify:

  • .github/workflows/build-and-release.yml (update permissions and replace auto-release job steps)

Deliverables expected in the PR:

  • New branch fix/auto-release-permissions-and-action with the updated workflow file.
  • Pull request with title: "Fix: auto-release permissions and replace third-party action with create-release".
  • PR description explaining the change and referencing the failing job URL.

Note: Use the provided workflow file reference when linking to the current file in the PR description (use ref bba6dea).

This pull request was created as a result of the following prompt from Copilot chat.

The repository's GitHub Actions workflow .github/workflows/build-and-release.yml currently fails in the auto-release job with "Resource not accessible by integration" when using marvinpinto/action-automatic-releases. Create a pull request that implements the following changes to reliably create the automatic "latest" prerelease using GitHub-maintained actions and appropriate workflow permissions.

References:

Required changes:

  1. Update the top-level permissions block to grant the workflow the needed permissions for creating releases and uploading assets. Replace the current block with:

permissions:
contents: write
packages: write
issues: read
pull-requests: read
actions: read

  1. Replace the auto-release job's use of marvinpinto/action-automatic-releases@latest with an implementation that uses actions/create-release@v1 and actions/upload-release-asset@v1. The new auto-release job should:
  • Keep needs: build, runs-on: ubuntu-latest, and the existing if condition to run only on main/master pushes.
  • Continue to checkout with fetch-depth: 0.
  • Build with Maven as before.
  • Calculate DATE and COUNT outputs as in the original job.
  • Create or update a "latest" prerelease via actions/create-release@v1 using GITHUB_TOKEN and set prerelease: true.
  • Find the built JAR artifacts dynamically (wildcard) and expose their paths via outputs.
  • Conditionally upload each artifact (Paper and Bungee) to the release using actions/upload-release-asset@v1, naming the assets with the DATE and COUNT (e.g., NetworkDataAPI-Paper-${{ steps.date.outputs.DATE }}-${{ steps.commit_count.outputs.COUNT }}.jar).

Include the exact replacement YAML for the auto-release job steps. The job must gracefully handle missing artifact files (skip upload if not found).

  1. Commit the changes on a new branch named fix/auto-release-permissions-and-action and open a pull request against the default branch with a clear title and description summarizing the fix and referencing the failing job ID.

Make sure the PR uses the repository's GITHUB_TOKEN (no PAT) and does not introduce any secrets. Keep all other jobs unchanged.

Files to modify:

  • .github/workflows/build-and-release.yml (update permissions and replace auto-release job steps)

Deliverables expected in the PR:

  • New branch fix/auto-release-permissions-and-action with the updated workflow file.
  • Pull request with title: "Fix: auto-release permissions and replace third-party action with create-release".
  • PR description explaining the change and referencing the failing job URL.

Note: Use the provided workflow file reference when linking to the current file in the PR description (use ref bba6dea).


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ate-release

Co-authored-by: Onbewolkt <164928935+Onbewolkt@users.noreply.github.com>
@nelihdev nelihdev marked this pull request as ready for review November 4, 2025 20:43
@nelihdev nelihdev merged commit ecfca48 into main Nov 4, 2025
7 of 8 checks passed
Copilot AI requested a review from nelihdev November 4, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants