Skip to content

Conversation

@brettfo
Copy link
Collaborator

@brettfo brettfo commented Jan 22, 2026

When a dependabot job is run, the auto-generated environment variable GITHUB_TOKEN already has the packges: read permissions.

This PR uses that value and elevates it to a GitHub package feed credential if:

  1. The experiment automatic_github_packages_auth is enabled
  2. The environment variable GITHUB_TOKEN can be resolved
  3. The package manager is something that GitHub packages supports
  4. No existing duplicate package feed credential exists

Copy link
Member

@jakecoffman jakecoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems right!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements automatic authentication for GitHub Packages by elevating the GITHUB_TOKEN environment variable to a package feed credential when specific conditions are met: the automatic_github_packages_auth experiment is enabled, GITHUB_TOKEN is available, the package manager supports GitHub Packages, and no duplicate credential exists.

Changes:

  • Added automatic GitHub Packages credential generation for NuGet when the experiment flag is enabled
  • Extended the JobDetails type with a source field containing repository information
  • Added comprehensive test coverage for the new credential generation logic

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 5 comments.

File Description
src/main.ts Implements getPackagesCredential() and getNuGetPackagesCredential() functions to create GitHub Packages credentials, and integrates them into the main credential workflow
src/api-client.ts Adds source field to JobDetails type to capture repository information needed for constructing package feed URLs
tests/main.test.ts Adds comprehensive test suite for getPackagesCredential() covering various scenarios including experiment flags, token availability, and duplicate detection
.gitattributes Adds binary handling for .exe files (unrelated to main PR purpose)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@brettfo brettfo force-pushed the dev/brettfo/github-packages branch 2 times, most recently from 4222e9e to da6cfec Compare January 23, 2026 17:26
@brettfo brettfo marked this pull request as ready for review January 23, 2026 17:26
@brettfo brettfo requested a review from a team as a code owner January 23, 2026 17:26
@brettfo brettfo force-pushed the dev/brettfo/github-packages branch 4 times, most recently from 34d818e to fd10732 Compare January 23, 2026 23:17
@brettfo brettfo force-pushed the dev/brettfo/github-packages branch from fd10732 to 5462515 Compare January 27, 2026 16:49
@brettfo brettfo force-pushed the dev/brettfo/github-packages branch from 5462515 to c69d6a8 Compare January 27, 2026 17:00
@brettfo brettfo merged commit c1e3288 into github:main Jan 27, 2026
6 checks passed
@brettfo brettfo deleted the dev/brettfo/github-packages branch January 27, 2026 20:55
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