3
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-22 11:25:31 +00:00

No-op on GHES

This commit is contained in:
Dave Hadka 2020-09-29 09:58:32 -05:00
parent eed9cfe64d
commit 4d604c6cce
5 changed files with 60 additions and 0 deletions

View file

@ -6,6 +6,12 @@ import * as utils from "./utils/actionUtils";
async function run(): Promise<void> {
try {
if (utils.isGhes()) {
core.info("Cache action is not supported on GHES");
utils.setCacheHitOutput(false);
return;
}
// Validate inputs, this can cause task failure
if (!utils.isValidEvent()) {
utils.logWarning(

View file

@ -6,6 +6,11 @@ import * as utils from "./utils/actionUtils";
async function run(): Promise<void> {
try {
if (utils.isGhes()) {
core.info("Cache action is not supported on GHES");
return;
}
if (!utils.isValidEvent()) {
utils.logWarning(
`Event Validation Error: The event type ${

View file

@ -2,6 +2,13 @@ import * as core from "@actions/core";
import { Outputs, RefKey, State } from "../constants";
export function isGhes(): boolean {
const ghUrl = new URL(
process.env["GITHUB_SERVER_URL"] || "https://github.com"
);
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
}
export function isExactKeyMatch(key: string, cacheKey?: string): boolean {
return !!(
cacheKey &&