mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-30 17:27:26 +00:00
c0a76247d6
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>
18 lines
543 B
TypeScript
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);
|
|
}
|