Skip to content

Commit e152b90

Browse files
committed
feat: skip harden-runner based on repository custom property
1 parent ee1faec commit e152b90

File tree

9 files changed

+26
-57
lines changed

9 files changed

+26
-57
lines changed

action.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ inputs:
3232
description: "Policy name to be used from the policy store"
3333
required: false
3434
default: ""
35-
skip-on-custom-property:
36-
description: "Skip if custom property matches value (format: property_name=value)"
37-
required: false
38-
default: ""
39-
4035
branding:
4136
icon: "check-square"
4237
color: "green"

dist/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32086,14 +32086,10 @@ var src_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argu
3208632086
(() => src_awaiter(void 0, void 0, void 0, function* () {
3208732087
var _a, _b;
3208832088
console.log("[harden-runner] main-step");
32089-
const skipOnProperty = lib_core.getInput("skip-on-custom-property");
32090-
if (skipOnProperty) {
32091-
const [propertyName, expectedValue] = skipOnProperty.split("=");
32092-
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) || {};
32093-
if (customProperties[propertyName] === expectedValue) {
32094-
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
32095-
return;
32096-
}
32089+
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) || {};
32090+
if (customProperties["skip-harden-runner"] === "true") {
32091+
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
32092+
return;
3209732093
}
3209832094
if (process.platform !== "linux") {
3209932095
console.log(UBUNTU_MESSAGE);

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/post/index.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32132,18 +32132,13 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
3213232132

3213332133

3213432134

32135-
3213632135
(() => cleanup_awaiter(void 0, void 0, void 0, function* () {
3213732136
var _a, _b;
3213832137
console.log("[harden-runner] post-step");
32139-
const skipOnProperty = lib_core.getInput("skip-on-custom-property");
32140-
if (skipOnProperty) {
32141-
const [propertyName, expectedValue] = skipOnProperty.split("=");
32142-
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) || {};
32143-
if (customProperties[propertyName] === expectedValue) {
32144-
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
32145-
return;
32146-
}
32138+
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) || {};
32139+
if (customProperties["skip-harden-runner"] === "true") {
32140+
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
32141+
return;
3214732142
}
3214832143
if (process.platform !== "linux") {
3214932144
console.log(UBUNTU_MESSAGE);

dist/post/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pre/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85612,14 +85612,10 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
8561285612
var _a, _b, _c, _d;
8561385613
try {
8561485614
console.log("[harden-runner] pre-step");
85615-
const skipOnProperty = lib_core.getInput("skip-on-custom-property");
85616-
if (skipOnProperty) {
85617-
const [propertyName, expectedValue] = skipOnProperty.split("=");
85618-
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) || {};
85619-
if (customProperties[propertyName] === expectedValue) {
85620-
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
85621-
return;
85622-
}
85615+
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) || {};
85616+
if (customProperties["skip-harden-runner"] === "true") {
85617+
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
85618+
return;
8562385619
}
8562485620
if (process.platform !== "linux") {
8562585621
console.log(UBUNTU_MESSAGE);

src/cleanup.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as fs from "fs";
22
import * as cp from "child_process";
3-
import * as core from "@actions/core";
43
import * as common from "./common";
54
import isDocker from "is-docker";
65
import { isARCRunner } from "./arc-runner";
@@ -9,14 +8,10 @@ import { context } from "@actions/github";
98
(async () => {
109
console.log("[harden-runner] post-step");
1110

12-
const skipOnProperty = core.getInput("skip-on-custom-property");
13-
if (skipOnProperty) {
14-
const [propertyName, expectedValue] = skipOnProperty.split("=");
15-
const customProperties = context?.payload?.repository?.custom_properties || {};
16-
if (customProperties[propertyName] === expectedValue) {
17-
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
18-
return;
19-
}
11+
const customProperties = context?.payload?.repository?.custom_properties || {};
12+
if (customProperties["skip-harden-runner"] === "true") {
13+
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
14+
return;
2015
}
2116

2217
if (process.platform !== "linux") {

src/index.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ import { context } from "@actions/github";
77
(async () => {
88
console.log("[harden-runner] main-step");
99

10-
const skipOnProperty = core.getInput("skip-on-custom-property");
11-
if (skipOnProperty) {
12-
const [propertyName, expectedValue] = skipOnProperty.split("=");
13-
const customProperties = context?.payload?.repository?.custom_properties || {};
14-
if (customProperties[propertyName] === expectedValue) {
15-
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
16-
return;
17-
}
10+
const customProperties = context?.payload?.repository?.custom_properties || {};
11+
if (customProperties["skip-harden-runner"] === "true") {
12+
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
13+
return;
1814
}
1915

2016
if (process.platform !== "linux") {

src/setup.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@ interface MonitorResponse {
3939
try {
4040
console.log("[harden-runner] pre-step");
4141

42-
const skipOnProperty = core.getInput("skip-on-custom-property");
43-
if (skipOnProperty) {
44-
const [propertyName, expectedValue] = skipOnProperty.split("=");
45-
const customProperties = context?.payload?.repository?.custom_properties || {};
46-
if (customProperties[propertyName] === expectedValue) {
47-
console.log(`Skipping harden-runner: custom property '${propertyName}' equals '${expectedValue}'`);
48-
return;
49-
}
42+
const customProperties = context?.payload?.repository?.custom_properties || {};
43+
if (customProperties["skip-harden-runner"] === "true") {
44+
console.log("Skipping harden-runner: custom property 'skip-harden-runner' is set to 'true'");
45+
return;
5046
}
5147

5248
if (process.platform !== "linux") {

0 commit comments

Comments
 (0)