Skip to content
Open
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
12 changes: 11 additions & 1 deletion .github/workflows/actions_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ on:
tag:
description: "Tag for the release"
required: true
script:
required: true
type: string
default: 'npm run all'
node_version:
description: "Specify Node.js version (e.g., '18', '20', 'lts/*')"
required: false
default: "24"

permissions:
contents: read
Expand All @@ -18,4 +26,6 @@ jobs:
contents: write
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
with:
tag: "${{ github.event.inputs.tag }}"
tag: "${{ github.event.inputs.tag }}"
script: "${{ github.event.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 @@ -10,6 +10,10 @@ on:
description: "Specify a base branch"
required: false
default: "main"
node_version:
description: "Specify Node.js version (e.g., '18', '20', 'lts/*')"
required: false
default: "24"

schedule:
- cron: "0 0 * * 1"
Expand All @@ -20,6 +24,7 @@ jobs:
with:
force: ${{ inputs.force || false }}
base_branch: ${{ inputs.base_branch || 'main' }}
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 @@ -11,6 +11,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: [labeled, opened, synchronize]
Expand All @@ -30,3 +34,4 @@ jobs:
repo-name: "auth"
base_branch: ${{ inputs.base_branch || 'main' }}
mode: ${{ github.event_name == 'pull_request' && 'verify' || inputs.mode }}
node_version: "${{ inputs.node_version || '24' }}"
14 changes: 0 additions & 14 deletions .github/workflows/guarddog.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (c) 2023 StepSecurity
Copyright (c) 2026 StepSecurity

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
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)

# Authenticate to Google Cloud from GitHub Actions

Forked from [google-github-actions/auth](https://github.com/google-github-actions/auth)
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js

Large diffs are not rendered by default.

45 changes: 39 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
computeServiceAccountEmail,
generateCredentialsFilename,
} from './utils';
import * as fs from 'fs';
import { appendFileSync, existsSync } from 'fs';
import { relative, join } from 'path';
import * as core from '@actions/core';
Expand All @@ -63,17 +64,49 @@
`run from a fork. For more information, please see https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token`;

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

Check failure on line 67 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`
let repoPrivate: boolean | undefined

Check failure on line 68 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`

if (eventPath && fs.existsSync(eventPath)) {
const eventData = JSON.parse(fs.readFileSync(eventPath, 'utf8'))

Check failure on line 71 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`
repoPrivate = eventData?.repository?.private

Check failure on line 72 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`
}

const upstream = 'google-github-actions/auth'

Check failure on line 75 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`
const action = process.env.GITHUB_ACTION_REPOSITORY

Check failure on line 76 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`
const docsUrl =

Check failure on line 77 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Replace `⏎····'https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions'` with `·'https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions';`
'https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions'

core.info('')

Check failure on line 80 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`
core.info('\u001b[1;36mStepSecurity Maintained Action\u001b[0m')

Check failure on line 81 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`
core.info(`Secure drop-in replacement for ${upstream}`)

Check failure on line 82 in src/main.ts

View workflow job for this annotation

GitHub Actions / unit

Insert `;`
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');
process.exit(1);
} else {
core.info('Timeout or API not reachable. Continuing to next step.');
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)
}
core.info('Timeout or API not reachable. Continuing to next step.')
}
}

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"alwaysStrict": true,
"target": "es2022",
"target": "es2023",
"module": "commonjs",
"lib": ["es2022"],
"lib": ["es2023"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
Expand Down
Loading