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
5 changes: 5 additions & 0 deletions .github/workflows/actions_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
script:
required: false
default: "npm run build && npm run pack"
node_version:
description: "Specify Node.js version (e.g., '18', '20', 'lts/*')"
required: false
default: "24"

permissions:
contents: read
Expand All @@ -23,3 +27,4 @@ jobs:
with:
tag: "${{ github.event.inputs.tag }}"
script: ${{ inputs.script }}
node_version: "${{ github.event.inputs.node_version }}"
5 changes: 5 additions & 0 deletions .github/workflows/audit-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
script:
required: false
default: "npm run build && npm run pack"
node_version:
description: "Specify Node.js version (e.g., '18', '20', 'lts/*')"
required: false
default: "24"
schedule:
- cron: "0 0 * * 1"

Expand All @@ -24,6 +28,7 @@ jobs:
force: ${{ inputs.force || false }}
base_branch: ${{ inputs.base_branch || 'main' }}
script: ${{ inputs.script || 'npm run build && npm run pack' }}
node_version: "${{ inputs.node_version || '24' }}"

permissions:
contents: write
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ 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 @@ -34,3 +38,4 @@ jobs:
base_branch: ${{ inputs.base_branch }}
script: ${{ inputs.script }}
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)

# Setup GH CLI Action


Expand Down
32 changes: 26 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46406,18 +46406,38 @@ catch (error) {
core.setFailed(error.message);
}
async function validateSubscription() {
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;
if (eventPath && external_fs_.existsSync(eventPath)) {
const eventData = JSON.parse(external_fs_.readFileSync(eventPath, 'utf8'));
repoPrivate = eventData?.repository?.private;
}
const upstream = 'sersoft-gmbh/setup-gh-cli-action';
const action = process.env.GITHUB_ACTION_REPOSITORY;
const docsUrl = 'https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions';
core.info('');
core.info('StepSecurity Maintained Action');
core.info(`Secure drop-in replacement for ${upstream}`);
if (repoPrivate === false)
core.info('✓ Free for public repositories');
core.info(`Learn more: ${docsUrl}`);
core.info('');
if (repoPrivate === false)
return;
const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com';
const body = { action: action || '' };
if (serverUrl !== 'https://github.com')
body.ghes_server = serverUrl;
try {
await lib_axios.get(API_URL, { timeout: 3000 });
await lib_axios.post(`https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/maintained-actions-subscription`, body, { timeout: 3000 });
}
catch (error) {
if (axios_isAxiosError(error) && error.response?.status === 403) {
core.error('Subscription is not valid. Reach out to support@stepsecurity.io');
core.error(`This action requires a StepSecurity subscription for private repositories.`);
core.error(`Learn how to enable a subscription: ${docsUrl}`);
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.');
}
}

56 changes: 43 additions & 13 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,48 @@ try {
}

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

try {
await axios.get(API_URL, {timeout: 3000});
} catch (error) {
if (isAxiosError(error) && error.response?.status === 403) {
core.error(
'Subscription is not valid. Reach out to support@stepsecurity.io'
);
process.exit(1);
} else {
core.info('Timeout or API not reachable. Continuing to next step.');
}
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 = 'sersoft-gmbh/setup-gh-cli-action'
const action = process.env.GITHUB_ACTION_REPOSITORY
const docsUrl =
'https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions'

core.info('')
core.info('StepSecurity Maintained Action')
core.info(`Secure drop-in replacement for ${upstream}`)
if (repoPrivate === false)
core.info('✓ Free for public repositories')
core.info(`Learn more: ${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.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(
`This action requires a StepSecurity subscription for private repositories.`
)
core.error(
`Learn how to enable a subscription: ${docsUrl}`
)
process.exit(1)
}
core.info('Timeout or API not reachable. Continuing to next step.')
}
}
Loading