Skip to content

Commit 932fa5d

Browse files
code linted
1 parent 045ec47 commit 932fa5d

2 files changed

Lines changed: 45 additions & 49 deletions

File tree

dist/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,24 @@ async function validateSubscription() {
3838
const eventPath = process.env.GITHUB_EVENT_PATH;
3939
let repoPrivate;
4040
if (eventPath && fs.existsSync(eventPath)) {
41-
const eventData = JSON.parse(fs.readFileSync(eventPath, 'utf8'));
41+
const eventData = JSON.parse(fs.readFileSync(eventPath, "utf8"));
4242
repoPrivate = eventData?.repository?.private;
4343
}
44-
const upstream = 'maxim-lobanov/setup-xcode';
44+
const upstream = "maxim-lobanov/setup-xcode";
4545
const action = process.env.GITHUB_ACTION_REPOSITORY;
46-
const docsUrl = 'https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions';
47-
core.info('');
48-
core.info('\u001b[1;36mStepSecurity Maintained Action\u001b[0m');
46+
const docsUrl = "https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions";
47+
core.info("");
48+
core.info("\u001b[1;36mStepSecurity Maintained Action\u001b[0m");
4949
core.info(`Secure drop-in replacement for ${upstream}`);
5050
if (repoPrivate === false)
51-
core.info('\u001b[32m\u2713 Free for public repositories\u001b[0m');
51+
core.info("\u001b[32m\u2713 Free for public repositories\u001b[0m");
5252
core.info(`\u001b[36mLearn more:\u001b[0m ${docsUrl}`);
53-
core.info('');
53+
core.info("");
5454
if (repoPrivate === false)
5555
return;
56-
const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com';
57-
const body = { action: action || '' };
58-
if (serverUrl !== 'https://github.com')
56+
const serverUrl = process.env.GITHUB_SERVER_URL || "https://github.com";
57+
const body = { action: action || "" };
58+
if (serverUrl !== "https://github.com")
5959
body.ghes_server = serverUrl;
6060
try {
6161
await axios_1.default.post(`https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/maintained-actions-subscription`, body, { timeout: 3000 });
@@ -66,7 +66,7 @@ async function validateSubscription() {
6666
core.error(`\u001b[31mLearn how to enable a subscription: ${docsUrl}\u001b[0m`);
6767
process.exit(1);
6868
}
69-
core.info('Timeout or API not reachable. Continuing to next step.');
69+
core.info("Timeout or API not reachable. Continuing to next step.");
7070
}
7171
}
7272
async function run() {

src/setup-xcode.ts

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,46 @@ import axios, { isAxiosError } from "axios";
44
import { XcodeSelector } from "./xcode-selector";
55

66
async function validateSubscription(): Promise<void> {
7-
const eventPath = process.env.GITHUB_EVENT_PATH
8-
let repoPrivate: boolean | undefined
7+
const eventPath = process.env.GITHUB_EVENT_PATH;
8+
let repoPrivate: boolean | undefined;
99

10-
if (eventPath && fs.existsSync(eventPath)) {
11-
const eventData = JSON.parse(fs.readFileSync(eventPath, 'utf8'))
12-
repoPrivate = eventData?.repository?.private
13-
}
10+
if (eventPath && fs.existsSync(eventPath)) {
11+
const eventData = JSON.parse(fs.readFileSync(eventPath, "utf8"));
12+
repoPrivate = eventData?.repository?.private;
13+
}
1414

15-
const upstream = 'maxim-lobanov/setup-xcode'
16-
const action = process.env.GITHUB_ACTION_REPOSITORY
17-
const docsUrl =
18-
'https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions'
15+
const upstream = "maxim-lobanov/setup-xcode";
16+
const action = process.env.GITHUB_ACTION_REPOSITORY;
17+
const docsUrl = "https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions";
1918

20-
core.info('')
21-
core.info('\u001b[1;36mStepSecurity Maintained Action\u001b[0m')
22-
core.info(`Secure drop-in replacement for ${upstream}`)
23-
if (repoPrivate === false)
24-
core.info('\u001b[32m\u2713 Free for public repositories\u001b[0m')
25-
core.info(`\u001b[36mLearn more:\u001b[0m ${docsUrl}`)
26-
core.info('')
19+
core.info("");
20+
core.info("\u001b[1;36mStepSecurity Maintained Action\u001b[0m");
21+
core.info(`Secure drop-in replacement for ${upstream}`);
22+
if (repoPrivate === false) core.info("\u001b[32m\u2713 Free for public repositories\u001b[0m");
23+
core.info(`\u001b[36mLearn more:\u001b[0m ${docsUrl}`);
24+
core.info("");
2725

28-
if (repoPrivate === false) return
26+
if (repoPrivate === false) return;
2927

30-
const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com'
31-
const body: Record<string, string> = {action: action || ''}
32-
if (serverUrl !== 'https://github.com') body.ghes_server = serverUrl
33-
try {
34-
await axios.post(
35-
`https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/maintained-actions-subscription`,
36-
body,
37-
{timeout: 3000}
38-
)
39-
} catch (error) {
40-
if (isAxiosError(error) && error.response?.status === 403) {
41-
core.error(
42-
`\u001b[1;31mThis action requires a StepSecurity subscription for private repositories.\u001b[0m`
43-
)
44-
core.error(
45-
`\u001b[31mLearn how to enable a subscription: ${docsUrl}\u001b[0m`
46-
)
47-
process.exit(1)
28+
const serverUrl = process.env.GITHUB_SERVER_URL || "https://github.com";
29+
const body: Record<string, string> = { action: action || "" };
30+
if (serverUrl !== "https://github.com") body.ghes_server = serverUrl;
31+
try {
32+
await axios.post(
33+
`https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/maintained-actions-subscription`,
34+
body,
35+
{ timeout: 3000 },
36+
);
37+
} catch (error) {
38+
if (isAxiosError(error) && error.response?.status === 403) {
39+
core.error(
40+
`\u001b[1;31mThis action requires a StepSecurity subscription for private repositories.\u001b[0m`,
41+
);
42+
core.error(`\u001b[31mLearn how to enable a subscription: ${docsUrl}\u001b[0m`);
43+
process.exit(1);
44+
}
45+
core.info("Timeout or API not reachable. Continuing to next step.");
4846
}
49-
core.info('Timeout or API not reachable. Continuing to next step.')
50-
}
5147
}
5248

5349
async function run(): Promise<void> {

0 commit comments

Comments
 (0)