Skip to content

github: vendor isGhes() func from @actions/artifact module#974

Merged
crazy-max merged 1 commit intodocker:mainfrom
crazy-max:vendor-isghes
Feb 3, 2026
Merged

github: vendor isGhes() func from @actions/artifact module#974
crazy-max merged 1 commit intodocker:mainfrom
crazy-max:vendor-isghes

Conversation

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Feb 2, 2026

relates to actions/toolkit#2266
needed for #972

Can't use the isGhes() func anymore from @actions/artifact due to @actions/artifact/lib/internal/shared/config being internal since ESM-only packages do not support internal exports.

@crazy-max crazy-max marked this pull request as ready for review February 2, 2026 16:41

// Can't use the isGhes() func from @actions/artifact due to @actions/artifact/lib/internal/shared/config
// being internal since ESM-only packages do not support internal exports.
// https://github.com/actions/toolkit/blob/8351a5d84d862813d1bb8bdeef87b215f8a946f9/packages/artifact/src/internal/shared/config.ts#L27
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to use a tag instead of a commit as reference? That way it may be easier in future to consider "this was forked a few versions ago, let's look if there are any changes since vX.Y.Z"?

Copy link
Member Author

Choose a reason for hiding this comment

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

They don't use tags anymore unfortunately: https://github.com/actions/toolkit/tags

Copy link
Member

Choose a reason for hiding this comment

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

That's ... weird!! They try to move everyone to immutable and their own stuff doesn't even use tags? 🤯

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes very weird, it makes it hard to link npm module version with actual git ref

const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to copy the code verbatim (same names etc)?

Suggested change
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
const ghUrl = new URL(
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
)
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
const isGitHubHost = hostname === 'GITHUB.COM'
const isGheHost = hostname.endsWith('.GHE.COM')
const isLocalHost = hostname.endsWith('.LOCALHOST')
return !isGitHubHost && !isGheHost && !isLocalHost

Copy link
Member Author

@crazy-max crazy-max Feb 3, 2026

Choose a reason for hiding this comment

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

isGitHubEnterpriseCloudHost is more accurate to not confuse with GitHub Enterprise alone.

Copy link
Member

Choose a reason for hiding this comment

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

This one would still be nice though (if it works); it helps visually comparing and make sure we didn't diverge / missed changes from upstream.

Copy link
Member

Choose a reason for hiding this comment

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

Doh! Race condition in our comments 😂

Yeah, perhaps just renaming the var could work; mostly trying to keep them as close as possible 😅

@crazy-max crazy-max merged commit 4748d57 into docker:main Feb 3, 2026
108 of 109 checks passed
@crazy-max crazy-max deleted the vendor-isghes branch February 3, 2026 16:30
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