Skip to content

Commit 791a6f2

Browse files
committed
Update actions
1 parent 392fa86 commit 791a6f2

File tree

15 files changed

+464
-98
lines changed

15 files changed

+464
-98
lines changed

.github/actions/debug/action.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Setup Debug'
2+
description: 'Parse and setup debug environment variables'
3+
4+
inputs:
5+
debug:
6+
description: 'Debug input - accepts "0", "1", or DEBUG="..." format'
7+
required: false
8+
default: '0'
9+
10+
outputs:
11+
socket_cli_debug:
12+
description: 'The processed SOCKET_CLI_DEBUG value'
13+
value: ${{ steps.parse.outputs.socket_cli_debug }}
14+
debug_value:
15+
description: 'The processed DEBUG value'
16+
value: ${{ steps.parse.outputs.debug_value }}
17+
18+
runs:
19+
using: 'composite'
20+
steps:
21+
- name: Parse debug input
22+
id: parse
23+
shell: bash
24+
run: |
25+
debug_input="${{ inputs.debug }}"
26+
27+
# Check if input is in DEBUG='...' format
28+
if [[ "$debug_input" =~ ^DEBUG=[\'\"]*(.+)[\'\"]*$ ]]; then
29+
debug_value="${BASH_REMATCH[1]}"
30+
echo "socket_cli_debug=$debug_value" >> $GITHUB_OUTPUT
31+
echo "debug_value=$debug_value" >> $GITHUB_OUTPUT
32+
echo "DEBUG=$debug_value" >> $GITHUB_ENV
33+
echo "SOCKET_CLI_DEBUG=$debug_value" >> $GITHUB_ENV
34+
# Check if it's just a simple value (0, 1, or debug string)
35+
else
36+
echo "socket_cli_debug=$debug_input" >> $GITHUB_OUTPUT
37+
echo "debug_value=$debug_input" >> $GITHUB_OUTPUT
38+
echo "SOCKET_CLI_DEBUG=$debug_input" >> $GITHUB_ENV
39+
if [[ "$debug_input" != "0" ]]; then
40+
echo "DEBUG=$debug_input" >> $GITHUB_ENV
41+
fi
42+
fi
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Claude Auto Review
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
timeout_minutes:
7+
description: 'Timeout in minutes'
8+
required: false
9+
type: string
10+
default: '60'
11+
direct_prompt:
12+
description: 'Prompt for the review'
13+
required: false
14+
type: string
15+
default: |
16+
Please review this pull request and provide actionable feedback.
17+
18+
Focus on:
19+
- Code quality and best practices
20+
- Potential bugs or issues
21+
- Performance considerations
22+
- Security implications
23+
- Overall architecture and design decisions
24+
25+
Provide constructive feedback with specific suggestions for improvement.
26+
Use inline comments to highlight specific areas of concern. Be concise and clear in your feedback.
27+
allowed_tools:
28+
description: 'Allowed tools for the review'
29+
required: false
30+
type: string
31+
default: 'mcp__github__create_pending_pull_request_review,mcp__github__add_pull_request_review_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff'
32+
debug:
33+
description: 'Enable debug output'
34+
required: false
35+
type: string
36+
default: '0'
37+
secrets:
38+
anthropic_api_key:
39+
required: true
40+
41+
permissions:
42+
contents: read
43+
pull-requests: read
44+
id-token: write
45+
46+
jobs:
47+
auto-review:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
52+
with:
53+
fetch-depth: 1
54+
55+
- name: Setup debug
56+
uses: SocketDev/socket-registry/.github/actions/debug@main
57+
with:
58+
debug: ${{ inputs.debug }}
59+
60+
- name: Automatic PR Review
61+
uses: anthropics/claude-code-action@28f83620103c48a57093dcc2837eec89e036bb9f # beta
62+
with:
63+
anthropic_api_key: ${{ secrets.anthropic_api_key }}
64+
timeout_minutes: ${{ inputs.timeout_minutes }}
65+
direct_prompt: ${{ inputs.direct_prompt }}
66+
allowed_tools: ${{ inputs.allowed_tools }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Claude Code
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
debug:
7+
description: 'Enable debug output'
8+
required: false
9+
type: string
10+
default: '0'
11+
secrets:
12+
anthropic_api_key:
13+
required: true
14+
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
issues: write
19+
id-token: write
20+
21+
jobs:
22+
claude:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
with:
28+
fetch-depth: 1
29+
30+
- name: Setup debug
31+
uses: SocketDev/socket-registry/.github/actions/debug@main
32+
with:
33+
debug: ${{ inputs.debug }}
34+
35+
- name: Run Claude Code
36+
id: claude
37+
uses: anthropics/claude-code-action@28f83620103c48a57093dcc2837eec89e036bb9f # beta
38+
with:
39+
anthropic_api_key: ${{ secrets.anthropic_api_key }}

.github/actions/workflows/lint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node-version:
7+
description: 'Node version to use'
8+
required: false
9+
type: string
10+
default: '22'
11+
debug:
12+
description: 'Enable debug output'
13+
required: false
14+
type: string
15+
default: '0'
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
linting:
22+
name: Lint
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
27+
- name: Setup debug
28+
uses: SocketDev/socket-registry/.github/actions/debug@main
29+
with:
30+
debug: ${{ inputs.debug }}
31+
32+
- uses: SocketDev/socket-registry/.github/actions/setup@main
33+
with:
34+
node-version: ${{ inputs.node-version }}
35+
36+
- name: Run linting
37+
run: pnpm run check-ci
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Provenance
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
debug:
7+
description: 'Enable debug output'
8+
required: false
9+
type: string
10+
default: '0'
11+
node-version:
12+
description: 'Node version to use'
13+
required: false
14+
type: string
15+
default: '22'
16+
publish-script:
17+
description: 'NPM script to run for publishing'
18+
required: false
19+
type: string
20+
default: ''
21+
access-script:
22+
description: 'NPM script to run for access control'
23+
required: false
24+
type: string
25+
default: ''
26+
secrets:
27+
npm_token:
28+
required: true
29+
30+
permissions:
31+
contents: read
32+
id-token: write
33+
34+
jobs:
35+
build:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39+
40+
- name: Setup debug
41+
uses: SocketDev/socket-registry/.github/actions/debug@main
42+
with:
43+
debug: ${{ inputs.debug }}
44+
45+
- uses: SocketDev/socket-registry/.github/actions/setup@main
46+
with:
47+
node-version: ${{ inputs.node-version }}
48+
- run: pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.npm_token }}
49+
- run: pnpm run ${{ inputs.publish-script }}
50+
if: inputs.publish-script != ''
51+
env:
52+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
53+
- run: pnpm run ${{ inputs.access-script }}
54+
if: inputs.access-script != ''
55+
env:
56+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Socket Fix
2+
3+
# Recommended schedule for calling workflows:
4+
# schedule:
5+
# - cron: '0 0 * * *' # Run daily at midnight UTC
6+
# - cron: '0 12 * * *' # Run daily at noon UTC
7+
8+
on:
9+
workflow_call:
10+
inputs:
11+
debug:
12+
description: 'Enable debug output'
13+
required: false
14+
type: string
15+
default: '0'
16+
node-version:
17+
description: 'Node version to use'
18+
required: false
19+
type: string
20+
default: '22'
21+
glob-pattern:
22+
description: 'Glob pattern for files to fix'
23+
required: false
24+
type: string
25+
default: ''
26+
autopilot:
27+
description: 'Enable autopilot mode'
28+
required: false
29+
type: boolean
30+
default: true
31+
git-user-email:
32+
description: 'Git user email for commits'
33+
required: false
34+
type: string
35+
default: 'socket-fix[bot]@users.noreply.github.com'
36+
git-user-name:
37+
description: 'Git user name for commits'
38+
required: false
39+
type: string
40+
default: 'socket-fix[bot]'
41+
secrets:
42+
socket_cli_api_token:
43+
required: true
44+
github_token:
45+
required: true
46+
47+
permissions:
48+
contents: write
49+
pull-requests: write
50+
51+
jobs:
52+
socket-fix:
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout repo
56+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
57+
58+
- name: Setup debug
59+
uses: SocketDev/socket-registry/.github/actions/debug@main
60+
with:
61+
debug: ${{ inputs.debug }}
62+
63+
- uses: SocketDev/socket-cli/.github/actions/setup@main
64+
with:
65+
node-version: ${{ inputs.node-version }}
66+
67+
- name: Run Socket Fix CLI
68+
env:
69+
SOCKET_CLI_GITHUB_TOKEN: ${{ secrets.github_token }}
70+
SOCKET_CLI_GIT_USER_EMAIL: ${{ inputs.git-user-email }}
71+
SOCKET_CLI_GIT_USER_NAME: ${{ inputs.git-user-name }}
72+
SOCKET_CLI_API_TOKEN: ${{ secrets.socket_cli_api_token }}
73+
run: |
74+
AUTOPILOT_FLAG=""
75+
GLOB_FLAG=""
76+
77+
if [[ "${{ inputs.autopilot }}" == "true" ]]; then
78+
AUTOPILOT_FLAG="--autopilot"
79+
fi
80+
81+
if [[ -n "${{ inputs.glob-pattern }}" ]]; then
82+
GLOB_FLAG="--glob '${{ inputs.glob-pattern }}'"
83+
fi
84+
85+
pnpm dlx @socketsecurity/cli fix $AUTOPILOT_FLAG $GLOB_FLAG

.github/actions/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node-version:
7+
description: 'Node version to test'
8+
required: true
9+
type: string
10+
os:
11+
description: 'Operating system to run on'
12+
required: true
13+
type: string
14+
timeout-minutes:
15+
description: 'Timeout in minutes'
16+
required: false
17+
type: number
18+
default: 10
19+
debug:
20+
description: 'Enable debug output'
21+
required: false
22+
type: string
23+
default: '0'
24+
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
test:
30+
runs-on: ${{ inputs.os }}
31+
timeout-minutes: ${{ inputs.timeout-minutes }}
32+
steps:
33+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
34+
35+
- name: Setup debug
36+
uses: SocketDev/socket-registry/.github/actions/debug@main
37+
with:
38+
debug: ${{ inputs.debug }}
39+
40+
- uses: SocketDev/socket-registry/.github/actions/setup@main
41+
with:
42+
node-version: ${{ inputs.node-version }}
43+
44+
- name: Run tests
45+
run: pnpm run test-ci

0 commit comments

Comments
 (0)