Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 7, 2025

The Release Stage 2 workflow was failing when attempting to create GitHub releases with the following error:

! [remote rejected] v1.7.8 -> v1.7.8 (refusing to allow a GitHub App to create or update workflow `.github/workflows/release-stage-2_build_and_release.yml` without `workflows` permission)
error: failed to push some refs to 'https://github.com/homebridge/homebridge-apt-pkg'

Root Cause

The mini-bomba/create-github-release:v1.2.0 Docker action was attempting to create Git tags, but the workflow's GitHub token lacked the workflows permission required to create tags that could potentially trigger other workflows. This is a security feature in GitHub that prevents unauthorized workflow triggers via tag creation.

Solution

Added the workflows: write permission to the Release Stage 2 workflow and implemented concurrency controls to prevent race conditions:

permissions:
  contents: write
  actions: write
  id-token: write
  workflows: write  # Added this line

concurrency:
  group: release-stage-2
  cancel-in-progress: false

Changes Made

  • .github/workflows/release-stage-2_build_and_release.yml: Added workflows: write permission and concurrency controls
  • test/test-permissions-fix.sh: Created comprehensive test to validate the permissions fix
  • test/test-concurrency-fix.sh: Created test to validate the concurrency controls
  • PERMISSIONS_FIX.md: Added documentation explaining the permissions issue and solution
  • CONCURRENCY_FIX.md: Added documentation explaining the concurrency controls

Validation

  • All workflow YAML files remain syntactically valid
  • Created and verified permissions and concurrency validation tests pass
  • Existing reusable workflow tests continue to pass
  • No breaking changes to other workflows

The workflow now has proper concurrency controls to prevent multiple instances from running simultaneously (avoiding race conditions in package building, GitHub release creation, APT repository uploads, and NPM publishing) and sufficient permissions for tag creation, allowing stable, beta, and alpha releases to complete successfully.

Fixes #234.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits September 7, 2025 14:40
Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com>
Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Release stage 2 failed Fix Release Stage 2 failure: add workflows permission for tag creation Sep 7, 2025
Copilot finished work on behalf of NorthernMan54 September 7, 2025 14:41
@Copilot Copilot AI requested a review from NorthernMan54 September 7, 2025 14:41
@NorthernMan54
Copy link
Contributor

@copilot pls add concurrency checks to only allow a single instance of the action to at the same time

Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 7, 2025

@copilot pls add concurrency checks to only allow a single instance of the action to at the same time

Added concurrency controls to the Release Stage 2 workflow to prevent multiple instances from running simultaneously:

concurrency:
  group: release-stage-2
  cancel-in-progress: false

This ensures only one release process can run at a time, preventing race conditions in package building, GitHub release creation, APT repository uploads, and NPM publishing. The cancel-in-progress: false setting prevents interruption of already-running releases to maintain data integrity.

Commit: 9437d8e

@Copilot Copilot AI changed the title Fix Release Stage 2 failure: add workflows permission for tag creation Fix Release Stage 2 failure: add workflows permission and concurrency controls Sep 7, 2025
Copilot finished work on behalf of NorthernMan54 September 7, 2025 14:48
@NorthernMan54 NorthernMan54 marked this pull request as ready for review September 7, 2025 14:50
@NorthernMan54 NorthernMan54 merged commit 9ca8a1e into latest Sep 7, 2025
@NorthernMan54 NorthernMan54 deleted the copilot/fix-234 branch September 7, 2025 14:50
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.

Release stage 2 failed
2 participants