diff --git a/rule_action.go b/rule_action.go index 3cc181c64..5e3111183 100644 --- a/rule_action.go +++ b/rule_action.go @@ -286,6 +286,15 @@ var BrandingIcons = map[string]struct{}{ "zoom-out": {}, } +// These actions are still supported in GitHub Enterprise Server as the v4 back-end infrastructure +// that the *-artifact actions use is not available, or they depend on those v4 actions. +var outdatedPopularActionSpecsStillSupportedByGitHubEnterpriseServer = map[string]struct{}{ + "actions/deploy-pages@v2": {}, + "actions/download-artifact@v3": {}, + "actions/upload-artifact@v3": {}, + "actions/upload-pages-artifact@v3": {}, +} + // https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runsimage func isImageOnDockerRegistry(image string) bool { return strings.HasPrefix(image, "docker://") || @@ -374,7 +383,12 @@ func (rule *RuleAction) checkRepoAction(spec string, exec *ExecAction) { meta, ok := PopularActions[spec] if !ok { if _, ok := OutdatedPopularActionSpecs[spec]; ok { - rule.Errorf(exec.Uses.Pos, "the runner of %q action is too old to run on GitHub Actions. update the action's version to fix this issue", spec) + serverURL := os.Getenv("GITHUB_SERVER_URL") + isGHES := serverURL != "https://github.com" && !strings.HasSuffix(serverURL, ".ghe.com") + _, stillSupported := outdatedPopularActionSpecsStillSupportedByGitHubEnterpriseServer[spec] + if !isGHES || !stillSupported { + rule.Errorf(exec.Uses.Pos, "the runner of %q action is too old to run on GitHub Actions. update the action's version to fix this issue", spec) + } return } rule.Debug("This action is not found in popular actions data set: %s", spec)