Files
Jamie Tanna c0a76247d6 fix(manager/github-actions): match actions/setup- actions referenced by an https:// URL
Via #35777, we have cases where a self-hosted user who doesn't run against
github.com leads to cases where they can't update the builtin Actions
when they're referenced by an `https://` URL.

As we already handle this for community actions, we can also handle this
for the builtin ones.

Co-Authored-By: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-09-11 13:06:37 +01:00

18 lines
543 B
TypeScript

import { regEx } from '../../../util/regex.ts';
export function actionUsesRegex(action: string): RegExp {
return regEx(`(?:https?://[^/]+/)?${RegExp.escape(action)}(?:@.+)?$`);
}
/**
* Whether a `uses:` value refers to the given `owner/repo` action, allowing
* for an optional `https://<host>/` prefix (e.g. a self-hosted Forgejo/Gitea
* instance, or GitHub Enterprise Server).
*/
export function matchesAction(
uses: string | null | undefined,
action: string,
): boolean {
return !!uses && actionUsesRegex(action).test(uses);
}