Skip to content

Bug: Compose auth.json always being written to with GITHUB_TOKEN causing issues with Enterprise GitHub workflows #981

@Sn0wCrack

Description

@Sn0wCrack

Describe the bug

With a recent update, the auth.json file for Composer is always written to using the GITHUB_TOKEN environment.

This is fantastic for running workflows against public GitHub to reduce running into rate limits or other issues, however in Enterprise scenarios this GITHUB_TOKEN only provides access to the Enterprise the runner is attached to, not to the publicly available GitHub.

This causes authentication issues with GitHub on these runners and leads to composer falling back to cloning the repository in each case rather than downloading the release ZIP file.

My current workaround is I have created an empty auth.json file containing {} as its contents and then marked the file as immutable to prevent it being overwritten by this action.

Solutions for this would be:

  • By default do not write auth.json for Enterprise. Perhaps adding another running type called enterprise that inherits the self-hosted properties plus a few extra things such as this.
  • Allow using COMPOSER_TOKEN to overwrite GITHUB_TOKEN to allow setting a permanent PAT in the self hosted GitHub Action Runner's .env file.

To add to the second point, I see at points during the codebase that GITHUB_TOKEN has a fallback to COMPOSER_TOKEN, however, GITHUB_TOKEN is always set during an action, so there is never a condition COMPOSER_TOKEN is used.

Version

  • v2
  • v1

Runners

Self Hosted

Operating systems

Ubuntu 24.04

PHP versions

PHP 8.2, 8.4

To Reproduce

Requires a GitHub Enterprise setup to test, this will happen on essentially any stock standard self-hosted runner.

Expected behavior

Writing to auth.json can be disabled or somehow globally overwritten.

Screenshots/Logs

No response

Additional context

No response

Are you willing to submit a PR?

Yes

Metadata

Metadata

Assignees

Labels

awaiting-releaseAdded/Fixed and tested, awaiting releasebugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions