feat: skip harden-runner based on repository custom property

This commit is contained in:
Varun Sharma 2025-12-06 14:20:59 -08:00
commit e152b90204
9 changed files with 26 additions and 57 deletions

View file

@ -32,11 +32,6 @@ inputs:
description: "Policy name to be used from the policy store"
required: false
default: ""
skip-on-custom-property:
description: "Skip if custom property matches value (format: property_name=value)"
required: false
default: ""
branding:
icon: "check-square"
color: "green"

12
dist/index.js vendored
View file

@ -32086,14 +32086,10 @@ var src_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argu
(() => src_awaiter(void 0, void 0, void 0, function* () {
var _a, _b;
console.log("[harden-runner] main-step");
const skipOnProperty = lib_core.getInput("skip-on-custom-property");
if (skipOnProperty) {
const [propertyName, expectedValue] = skipOnProperty.split("=");
const customProperties = ((_b = (_a = github.context === null || github.context === void 0 ? void 0 : github.context.payload) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.custom_properties) || {};
if (customProperties[propertyName] === expectedValue) {
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
return;
}
const customProperties = ((_b = (_a = github.context === null || github.context === void 0 ? void 0 : github.context.payload) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.custom_properties) || {};
if (customProperties["skip-harden-runner"] === "true") {
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
return;
}
if (process.platform !== "linux") {
console.log(UBUNTU_MESSAGE);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

13
dist/post/index.js vendored
View file

@ -32132,18 +32132,13 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
(() => cleanup_awaiter(void 0, void 0, void 0, function* () {
var _a, _b;
console.log("[harden-runner] post-step");
const skipOnProperty = lib_core.getInput("skip-on-custom-property");
if (skipOnProperty) {
const [propertyName, expectedValue] = skipOnProperty.split("=");
const customProperties = ((_b = (_a = github.context === null || github.context === void 0 ? void 0 : github.context.payload) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.custom_properties) || {};
if (customProperties[propertyName] === expectedValue) {
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
return;
}
const customProperties = ((_b = (_a = github.context === null || github.context === void 0 ? void 0 : github.context.payload) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.custom_properties) || {};
if (customProperties["skip-harden-runner"] === "true") {
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
return;
}
if (process.platform !== "linux") {
console.log(UBUNTU_MESSAGE);

File diff suppressed because one or more lines are too long

12
dist/pre/index.js vendored
View file

@ -85612,14 +85612,10 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
var _a, _b, _c, _d;
try {
console.log("[harden-runner] pre-step");
const skipOnProperty = lib_core.getInput("skip-on-custom-property");
if (skipOnProperty) {
const [propertyName, expectedValue] = skipOnProperty.split("=");
const customProperties = ((_b = (_a = github.context === null || github.context === void 0 ? void 0 : github.context.payload) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.custom_properties) || {};
if (customProperties[propertyName] === expectedValue) {
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
return;
}
const customProperties = ((_b = (_a = github.context === null || github.context === void 0 ? void 0 : github.context.payload) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.custom_properties) || {};
if (customProperties["skip-harden-runner"] === "true") {
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
return;
}
if (process.platform !== "linux") {
console.log(UBUNTU_MESSAGE);

View file

@ -1,6 +1,5 @@
import * as fs from "fs";
import * as cp from "child_process";
import * as core from "@actions/core";
import * as common from "./common";
import isDocker from "is-docker";
import { isARCRunner } from "./arc-runner";
@ -9,14 +8,10 @@ import { context } from "@actions/github";
(async () => {
console.log("[harden-runner] post-step");
const skipOnProperty = core.getInput("skip-on-custom-property");
if (skipOnProperty) {
const [propertyName, expectedValue] = skipOnProperty.split("=");
const customProperties = context?.payload?.repository?.custom_properties || {};
if (customProperties[propertyName] === expectedValue) {
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
return;
}
const customProperties = context?.payload?.repository?.custom_properties || {};
if (customProperties["skip-harden-runner"] === "true") {
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
return;
}
if (process.platform !== "linux") {

View file

@ -7,14 +7,10 @@ import { context } from "@actions/github";
(async () => {
console.log("[harden-runner] main-step");
const skipOnProperty = core.getInput("skip-on-custom-property");
if (skipOnProperty) {
const [propertyName, expectedValue] = skipOnProperty.split("=");
const customProperties = context?.payload?.repository?.custom_properties || {};
if (customProperties[propertyName] === expectedValue) {
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
return;
}
const customProperties = context?.payload?.repository?.custom_properties || {};
if (customProperties["skip-harden-runner"] === "true") {
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
return;
}
if (process.platform !== "linux") {

View file

@ -39,14 +39,10 @@ interface MonitorResponse {
try {
console.log("[harden-runner] pre-step");
const skipOnProperty = core.getInput("skip-on-custom-property");
if (skipOnProperty) {
const [propertyName, expectedValue] = skipOnProperty.split("=");
const customProperties = context?.payload?.repository?.custom_properties || {};
if (customProperties[propertyName] === expectedValue) {
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
return;
}
const customProperties = context?.payload?.repository?.custom_properties || {};
if (customProperties["skip-harden-runner"] === "true") {
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
return;
}
if (process.platform !== "linux") {