Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/actions_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ on:
yarn_version:
required: false
type: string
default: "3.6.3"
default: "3.6.3"
node_version:
description: "Specify Node.js version (e.g., '18', '20', 'lts/*')"
required: false
default: "24"

permissions:
contents: read
Expand All @@ -29,4 +33,5 @@ jobs:
with:
tag: "${{ github.event.inputs.tag }}"
script: "${{ github.event.inputs.script }}"
yarn_version: "${{ github.event.inputs.yarn_version }}"
yarn_version: "${{ github.event.inputs.yarn_version }}"
node_version: "${{ github.event.inputs.node_version }}"
9 changes: 7 additions & 2 deletions .github/workflows/audit_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ on:
yarn_version:
required: false
type: string
default: "3.6.3"

default: "3.6.3"
node_version:
description: "Specify Node.js version (e.g., '18', '20', 'lts/*')"
required: false
default: "24"

schedule:
- cron: "0 0 * * 1"

Expand All @@ -32,6 +36,7 @@ jobs:
package_manager: "yarn"
script: ${{ inputs.script || 'yarn all' }}
yarn_version: ${{ inputs.yarn_version || '3.6.3' }}
node_version: "${{ inputs.node_version || '24' }}"

permissions:
contents: write
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
description: "Run mode: cherry-pick or verify"
required: false
default: "cherry-pick"
node_version:
description: "Specify Node.js version (e.g., '18', '20', 'lts/*')"
required: false
default: "24"

pull_request:
types: [opened, synchronize, labeled]
Expand All @@ -46,4 +50,5 @@ jobs:
script: ${{ inputs.script || 'yarn all' }}
yarn_version: ${{ inputs.yarn_version || '3.6.3' }}
mode: ${{ github.event_name == 'pull_request' && 'verify' || inputs.mode }}
node_version: "${{ inputs.node_version || '24' }}"

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![StepSecurity Maintained Action](https://raw.githubusercontent.com/step-security/maintained-actions-assets/main/assets/maintained-action-banner.png)](https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions)

[![GitHub release](https://img.shields.io/github/release/step-security/ghaction-github-runtime.svg?style=flat-square)](https://github.com/step-security/ghaction-github-runtime/releases/latest)
[![GitHub marketplace](https://img.shields.io/badge/marketplace-github--runtime-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/github-runtime)

Expand Down
8 changes: 4 additions & 4 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

33 changes: 28 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
import * as core from '@actions/core';
import * as fs from 'fs';
import axios, {isAxiosError} from 'axios';
import * as github from './github.js';

async function validateSubscription(): Promise<void> {
const API_URL = `https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/subscription`;
const eventPath = process.env.GITHUB_EVENT_PATH;
let repoPrivate: boolean | undefined;

if (eventPath && fs.existsSync(eventPath)) {
const eventData = JSON.parse(fs.readFileSync(eventPath, 'utf8'));
repoPrivate = eventData?.repository?.private;
}

const upstream = 'crazy-max/ghaction-github-runtime';
const action = process.env.GITHUB_ACTION_REPOSITORY;
const docsUrl = 'https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions';

core.info('');
core.info('\u001b[1;36mStepSecurity Maintained Action\u001b[0m');
core.info(`Secure drop-in replacement for ${upstream}`);
if (repoPrivate === false) core.info('\u001b[32m\u2713 Free for public repositories\u001b[0m');
core.info(`\u001b[36mLearn more:\u001b[0m ${docsUrl}`);
core.info('');

if (repoPrivate === false) return;

const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com';
const body: Record<string, string> = {action: action || ''};
if (serverUrl !== 'https://github.com') body.ghes_server = serverUrl;
try {
await axios.get(API_URL, {timeout: 3000});
await axios.post(`https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/maintained-actions-subscription`, body, {timeout: 3000});
} catch (error) {
if (isAxiosError(error) && error.response?.status === 403) {
core.error('Subscription is not valid. Reach out to support@stepsecurity.io');
core.error(`\u001b[1;31mThis action requires a StepSecurity subscription for private repositories.\u001b[0m`);
core.error(`\u001b[31mLearn how to enable a subscription: ${docsUrl}\u001b[0m`);
process.exit(1);
} else {
core.info('Timeout or API not reachable. Continuing to next step.');
}
core.info('Timeout or API not reachable. Continuing to next step.');
}
}

Expand Down
Loading