Skip to content

Commit 61cdcd4

Browse files
feat: Onboard jannekem/run-python-script-action action
Signed-off-by: Anurag Rajawat <anurag@stepsecurity.io>
1 parent fc5dfbe commit 61cdcd4

20 files changed

Lines changed: 46390 additions & 1 deletion
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release GitHub Actions
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Tag for the release"
8+
required: true
9+
node_version:
10+
description: "Node.js version to use"
11+
required: false
12+
default: "24"
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
release:
19+
permissions:
20+
actions: read
21+
id-token: write
22+
contents: write
23+
24+
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
25+
with:
26+
tag: "${{ github.event.inputs.tag }}"
27+
node_version: ${{ inputs.node_version || '24' }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: NPM Audit Fix Run
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
force:
7+
description: "Use --force flag for npm audit fix?"
8+
required: true
9+
type: boolean
10+
base_branch:
11+
description: "Specify a base branch"
12+
required: false
13+
default: "main"
14+
node_version:
15+
description: "Node.js version to use"
16+
required: false
17+
default: "24"
18+
schedule:
19+
- cron: "0 0 * * 1"
20+
21+
jobs:
22+
audit-fix:
23+
uses: step-security/reusable-workflows/.github/workflows/audit_fix.yml@v1
24+
with:
25+
force: ${{ inputs.force || false }}
26+
base_branch: ${{ inputs.base_branch || 'main' }}
27+
node_version: ${{ inputs.node_version || '24' }}
28+
29+
permissions:
30+
contents: write
31+
pull-requests: write
32+
packages: read
33+
issues: write
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Auto Cherry-Pick from Upstream
2+
3+
on:
4+
workflow_run:
5+
workflows: [ "Release GitHub Actions" ]
6+
types:
7+
- completed
8+
9+
workflow_dispatch:
10+
inputs:
11+
base_branch:
12+
description: "Base branch to create the PR against"
13+
required: true
14+
default: "main"
15+
mode:
16+
description: "Run mode: cherry-pick or verify"
17+
required: false
18+
default: "cherry-pick"
19+
node_version:
20+
description: "Node.js version to use"
21+
required: false
22+
default: "24"
23+
24+
pull_request:
25+
types: [ opened, synchronize, labeled ]
26+
27+
permissions:
28+
contents: write
29+
pull-requests: write
30+
packages: read
31+
issues: write
32+
33+
jobs:
34+
cherry-pick:
35+
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch' || contains(fromJson(toJson(github.event.pull_request.labels)).*.name, 'review-required')
36+
uses: step-security/reusable-workflows/.github/workflows/auto_cherry_pick.yaml@v1
37+
with:
38+
original-owner: "jannekem"
39+
repo-name: "run-python-script-action"
40+
base_branch: ${{ inputs.base_branch || 'main' }}
41+
mode: ${{ github.event_name == 'pull_request' && 'verify' || inputs.mode || 'cherry-pick' }}
42+
node_version: ${{ inputs.node_version || '24' }}

.github/workflows/check-build.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Check build
2+
3+
on: push
4+
5+
jobs:
6+
check-build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v7
10+
- uses: actions/setup-node@v7
11+
with:
12+
node-version: "24"
13+
- run: npm install
14+
- run: npm run build
15+
- run: git diff --exit-code

.github/workflows/smoke-test.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Smoke test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
smoke-test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v7
12+
13+
- uses: actions/setup-python@v7
14+
with:
15+
python-version: "3.x"
16+
17+
- name: Run basic script
18+
id: basic
19+
uses: ./
20+
with:
21+
util: false
22+
script: |
23+
print("smoke-ok")
24+
25+
- name: Verify basic script outputs
26+
run: |
27+
test "${{ steps.basic.outputs.error }}" = "false"
28+
test "${{ steps.basic.outputs.stderr }}" = ""
29+
grep -F "smoke-ok" <<< '${{ steps.basic.outputs.stdout }}'
30+
31+
- name: Run script with utility functions
32+
id: utility
33+
uses: ./
34+
with:
35+
util: true
36+
script: |
37+
set_output("utility_result", "utility-ok")
38+
print("utility-stdout")
39+
40+
- name: Verify utility script outputs
41+
run: |
42+
test "${{ steps.utility.outputs.error }}" = "false"
43+
grep -F "utility-ok" <<< '${{ steps.utility.outputs.utility_result }}'
44+
grep -F "utility-stdout" <<< '${{ steps.utility.outputs.stdout }}'
45+
46+
- name: Run non-fatal failing script
47+
id: failure
48+
uses: ./
49+
with:
50+
fail-on-error: false
51+
util: false
52+
script: |
53+
import sys
54+
print("failure-stdout")
55+
print("failure-stderr", file=sys.stderr)
56+
sys.exit(7)
57+
58+
- name: Verify non-fatal failure outputs
59+
run: |
60+
test "${{ steps.failure.outputs.error }}" = "true"
61+
grep -F "failure-stdout" <<< '${{ steps.failure.outputs.stdout }}'
62+
grep -F "failure-stderr" <<< '${{ steps.failure.outputs.stderr }}'

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
venv/
3+
__pycache__
4+
.idea

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
min-release-age=3

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Janne Kemppainen
4+
Copyright (c) 2026 StepSecurity
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

0 commit comments

Comments
 (0)