@codfish/actions 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/codeql-config.yml +21 -0
- package/.github/dependabot.yml +35 -0
- package/.github/workflows/claude-code-review.yml +43 -0
- package/.github/workflows/claude.yml +39 -0
- package/.github/workflows/release.yml +48 -0
- package/.github/workflows/security.yml +103 -0
- package/.github/workflows/update-docs.yml +38 -0
- package/.github/workflows/validate.yml +210 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/AGENT.md +129 -0
- package/CLAUDE.md +3 -0
- package/CONTRIBUTING.md +316 -0
- package/README.md +207 -0
- package/SECURITY.md +208 -0
- package/bin/generate-docs.js +432 -0
- package/comment/README.md +82 -0
- package/comment/action.yml +102 -0
- package/eslint.config.js +8 -0
- package/npm-publish-pr/README.md +145 -0
- package/npm-publish-pr/action.yml +171 -0
- package/package.json +52 -0
- package/setup-node-and-install/README.md +139 -0
- package/setup-node-and-install/action.yml +220 -0
- package/tests/fixtures/.node-version +1 -0
- package/tests/fixtures/.nvmrc +1 -0
- package/tests/fixtures/lockfiles/package-lock.json +12 -0
- package/tests/fixtures/lockfiles/pnpm-lock.yaml +9 -0
- package/tests/fixtures/lockfiles/yarn.lock +7 -0
- package/tests/fixtures/package-json/minimal.json +4 -0
- package/tests/fixtures/package-json/scoped.json +6 -0
- package/tests/fixtures/package-json/valid.json +13 -0
- package/tests/integration/comment/basic.bats +95 -0
- package/tests/integration/npm-pr-version/basic.bats +353 -0
- package/tests/integration/setup-node-and-install/basic.bats +200 -0
- package/tests/scripts/test-helpers.sh +113 -0
- package/tests/scripts/test-runner.sh +115 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: GitHub Actions Security Analysis
|
|
2
|
+
|
|
3
|
+
disable-default-queries: false
|
|
4
|
+
|
|
5
|
+
queries:
|
|
6
|
+
- uses: security-and-quality
|
|
7
|
+
- uses: security-experimental
|
|
8
|
+
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- tests/
|
|
11
|
+
- '**/*.test.js'
|
|
12
|
+
- '**/*.spec.js'
|
|
13
|
+
- '**/node_modules'
|
|
14
|
+
- '**/dist'
|
|
15
|
+
- '**/build'
|
|
16
|
+
|
|
17
|
+
paths:
|
|
18
|
+
- '**/*.js'
|
|
19
|
+
- '**/*.yml'
|
|
20
|
+
- '**/*.yaml'
|
|
21
|
+
- '**/*.json'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# Enable version updates for pnpm dependencies
|
|
4
|
+
- package-ecosystem: npm
|
|
5
|
+
directory: /
|
|
6
|
+
schedule:
|
|
7
|
+
interval: weekly
|
|
8
|
+
day: monday
|
|
9
|
+
time: '09:00'
|
|
10
|
+
open-pull-requests-limit: 3
|
|
11
|
+
reviewers:
|
|
12
|
+
- codfish
|
|
13
|
+
assignees:
|
|
14
|
+
- codfish
|
|
15
|
+
commit-message:
|
|
16
|
+
prefix: deps
|
|
17
|
+
include: scope
|
|
18
|
+
# Use pnpm for package management
|
|
19
|
+
versioning-strategy: increase
|
|
20
|
+
|
|
21
|
+
# Monitor GitHub Actions for updates
|
|
22
|
+
- package-ecosystem: github-actions
|
|
23
|
+
directory: /
|
|
24
|
+
schedule:
|
|
25
|
+
interval: weekly
|
|
26
|
+
day: monday
|
|
27
|
+
time: '09:00'
|
|
28
|
+
open-pull-requests-limit: 3
|
|
29
|
+
reviewers:
|
|
30
|
+
- codfish
|
|
31
|
+
assignees:
|
|
32
|
+
- codfish
|
|
33
|
+
commit-message:
|
|
34
|
+
prefix: ci
|
|
35
|
+
include: scope
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Claude Code Review
|
|
2
|
+
|
|
3
|
+
on: pull_request_target
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
claude-review:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pull-requests: write
|
|
12
|
+
issues: read
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout repository
|
|
17
|
+
uses: actions/checkout@v5
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 1
|
|
20
|
+
|
|
21
|
+
- name: Run Claude Code Review
|
|
22
|
+
id: claude-review
|
|
23
|
+
uses: anthropics/claude-code-action@beta
|
|
24
|
+
with:
|
|
25
|
+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
26
|
+
|
|
27
|
+
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
|
|
28
|
+
# model: "claude-opus-4-20250514"
|
|
29
|
+
|
|
30
|
+
allowed_tools:
|
|
31
|
+
'mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr
|
|
32
|
+
view:*)'
|
|
33
|
+
|
|
34
|
+
# Direct prompt for automated review (no @claude mention needed)
|
|
35
|
+
direct_prompt: |
|
|
36
|
+
Please review this pull request and provide feedback on:
|
|
37
|
+
- Code quality and best practices
|
|
38
|
+
- Potential bugs or issues
|
|
39
|
+
- Performance considerations
|
|
40
|
+
- Security concerns
|
|
41
|
+
- Test coverage
|
|
42
|
+
|
|
43
|
+
Be constructive and helpful in your feedback.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Claude Code
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
pull_request_review_comment:
|
|
7
|
+
types: [created]
|
|
8
|
+
issues:
|
|
9
|
+
types: [opened, assigned]
|
|
10
|
+
pull_request_review:
|
|
11
|
+
types: [submitted]
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
claude:
|
|
15
|
+
if: |
|
|
16
|
+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
17
|
+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
18
|
+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
|
19
|
+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
|
20
|
+
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
pull-requests: read
|
|
26
|
+
issues: read
|
|
27
|
+
id-token: write
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout repository
|
|
31
|
+
uses: actions/checkout@v5
|
|
32
|
+
with:
|
|
33
|
+
fetch-depth: 1
|
|
34
|
+
|
|
35
|
+
- name: Run Claude Code
|
|
36
|
+
id: claude
|
|
37
|
+
uses: anthropics/claude-code-action@beta
|
|
38
|
+
with:
|
|
39
|
+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- alpha
|
|
8
|
+
- beta
|
|
9
|
+
- canary
|
|
10
|
+
- next
|
|
11
|
+
- next-major
|
|
12
|
+
- '[0-9]+.x'
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
issues: write
|
|
16
|
+
contents: write
|
|
17
|
+
pull-requests: write
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
release:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
|
|
23
|
+
concurrency:
|
|
24
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
25
|
+
cancel-in-progress: false
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v5
|
|
29
|
+
with:
|
|
30
|
+
persist-credentials: false
|
|
31
|
+
|
|
32
|
+
- uses: ./setup-node-and-install
|
|
33
|
+
with:
|
|
34
|
+
node-version: lts/*
|
|
35
|
+
|
|
36
|
+
- name: validate before release
|
|
37
|
+
run: |
|
|
38
|
+
pnpm install
|
|
39
|
+
pnpm lint
|
|
40
|
+
pnpm test
|
|
41
|
+
env:
|
|
42
|
+
CI: true
|
|
43
|
+
|
|
44
|
+
- name: semantic release
|
|
45
|
+
uses: docker://ghcr.io/codfish/semantic-release-action@sha256:5d5447090feb2f9252aac2825ef14e244ecf53528fbe87d585b459adb547b914
|
|
46
|
+
env:
|
|
47
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
48
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name: Security
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request_target:
|
|
7
|
+
branches: [main]
|
|
8
|
+
schedule:
|
|
9
|
+
# Run weekly security scan on Sundays at 2 AM UTC
|
|
10
|
+
- cron: '0 2 * * 0'
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
actions: read
|
|
14
|
+
contents: read
|
|
15
|
+
security-events: write
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
codeql:
|
|
19
|
+
name: CodeQL Analysis
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
|
+
matrix:
|
|
25
|
+
language: [javascript]
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout repository
|
|
29
|
+
uses: actions/checkout@v5
|
|
30
|
+
|
|
31
|
+
- name: Initialize CodeQL
|
|
32
|
+
uses: github/codeql-action/init@v3
|
|
33
|
+
with:
|
|
34
|
+
languages: ${{ matrix.language }}
|
|
35
|
+
config-file: ./.github/codeql-config.yml
|
|
36
|
+
|
|
37
|
+
- name: Autobuild
|
|
38
|
+
uses: github/codeql-action/autobuild@v3
|
|
39
|
+
|
|
40
|
+
- name: Perform CodeQL Analysis
|
|
41
|
+
uses: github/codeql-action/analyze@v3
|
|
42
|
+
with:
|
|
43
|
+
category: '/language:${{matrix.language}}'
|
|
44
|
+
|
|
45
|
+
dependency-review:
|
|
46
|
+
name: Dependency Review
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
if: github.event_name == 'pull_request_target'
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- name: Checkout repository
|
|
52
|
+
uses: actions/checkout@v5
|
|
53
|
+
|
|
54
|
+
- name: Dependency Review
|
|
55
|
+
uses: actions/dependency-review-action@v4
|
|
56
|
+
with:
|
|
57
|
+
fail-on-severity: moderate
|
|
58
|
+
allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-2-Clause-Views, BSD-3-Clause, ISC, AGPL-3.0
|
|
59
|
+
|
|
60
|
+
security-audit:
|
|
61
|
+
name: Security Audit
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
|
|
64
|
+
steps:
|
|
65
|
+
- name: Checkout repository
|
|
66
|
+
uses: actions/checkout@v5
|
|
67
|
+
|
|
68
|
+
- name: Setup Node.js and install dependencies
|
|
69
|
+
uses: ./setup-node-and-install
|
|
70
|
+
with:
|
|
71
|
+
node-version: 'lts/*'
|
|
72
|
+
|
|
73
|
+
- name: Run pnpm audit
|
|
74
|
+
run: |
|
|
75
|
+
echo "Running security audit..."
|
|
76
|
+
pnpm audit --audit-level=moderate
|
|
77
|
+
|
|
78
|
+
- name: Check for known vulnerabilities
|
|
79
|
+
run: |
|
|
80
|
+
echo "Checking for high/critical vulnerabilities..."
|
|
81
|
+
count=$(pnpm audit --audit-level=high --json | jq '.metadata.vulnerabilities.high + .metadata.vulnerabilities.critical')
|
|
82
|
+
if [ "$count" -gt 0 ]; then
|
|
83
|
+
echo "❌ High or critical vulnerabilities found!"
|
|
84
|
+
pnpm audit --audit-level=high
|
|
85
|
+
exit 1
|
|
86
|
+
else
|
|
87
|
+
echo "✅ No high or critical vulnerabilities found"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
secret-scan:
|
|
91
|
+
name: Secret Scan
|
|
92
|
+
runs-on: ubuntu-latest
|
|
93
|
+
|
|
94
|
+
steps:
|
|
95
|
+
- name: Checkout repository
|
|
96
|
+
uses: actions/checkout@v5
|
|
97
|
+
with:
|
|
98
|
+
fetch-depth: 0
|
|
99
|
+
|
|
100
|
+
- name: Run TruffleHog OSS
|
|
101
|
+
uses: trufflesecurity/trufflehog@v3.90.8
|
|
102
|
+
with:
|
|
103
|
+
extra_args: --debug --only-verified
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Update Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- '*/action.yml'
|
|
8
|
+
- bin/generate-docs.js
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
update-docs:
|
|
15
|
+
name: Auto-update documentation
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout repository
|
|
20
|
+
uses: actions/checkout@v5
|
|
21
|
+
with:
|
|
22
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
23
|
+
|
|
24
|
+
# Dogfood our own setup-node-and-install action
|
|
25
|
+
- name: Setup Node.js and install dependencies
|
|
26
|
+
uses: ./setup-node-and-install
|
|
27
|
+
with:
|
|
28
|
+
node-version: 'lts/*'
|
|
29
|
+
|
|
30
|
+
- name: Generate updated documentation
|
|
31
|
+
run: pnpm docs:generate
|
|
32
|
+
|
|
33
|
+
- name: Commit and push changes if any
|
|
34
|
+
uses: stefanzweifel/git-auto-commit-action@v6
|
|
35
|
+
with:
|
|
36
|
+
commit_options: --no-verify --signoff
|
|
37
|
+
commit_message: 'docs: auto-update documentation with latest action metadata'
|
|
38
|
+
file_pattern: 'README.md */README.md'
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
name: Validate
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request_target:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test Actions
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
pull-requests: write
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@v5
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
# Dogfood our own setup-node-and-install action
|
|
24
|
+
- name: Setup Node.js and install dependencies
|
|
25
|
+
uses: ./setup-node-and-install
|
|
26
|
+
with:
|
|
27
|
+
node-version: 'lts/*'
|
|
28
|
+
|
|
29
|
+
- name: Lint commits
|
|
30
|
+
if: github.event_name == 'pull_request_target'
|
|
31
|
+
run:
|
|
32
|
+
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
|
|
33
|
+
--verbose
|
|
34
|
+
|
|
35
|
+
- name: Lint code
|
|
36
|
+
run: pnpm lint
|
|
37
|
+
|
|
38
|
+
- name: Run tests
|
|
39
|
+
run: pnpm test
|
|
40
|
+
|
|
41
|
+
# Dogfood our own comment action on PRs
|
|
42
|
+
- name: Comment test results
|
|
43
|
+
if: github.event_name == 'pull_request_target'
|
|
44
|
+
uses: ./comment
|
|
45
|
+
with:
|
|
46
|
+
message: |
|
|
47
|
+
## 🧪 Test Results
|
|
48
|
+
|
|
49
|
+
✅ All tests passed successfully!
|
|
50
|
+
|
|
51
|
+
- Linting: ✅ Passed
|
|
52
|
+
- Unit tests: ✅ Passed
|
|
53
|
+
- Integration tests: ✅ Passed
|
|
54
|
+
tag: test-results
|
|
55
|
+
upsert: true
|
|
56
|
+
|
|
57
|
+
test-matrix:
|
|
58
|
+
name: Test on ${{ matrix.os }}
|
|
59
|
+
runs-on: ${{ matrix.os }}
|
|
60
|
+
strategy:
|
|
61
|
+
matrix:
|
|
62
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
63
|
+
node-version: ['20', '24', 'lts/*']
|
|
64
|
+
fail-fast: false
|
|
65
|
+
|
|
66
|
+
steps:
|
|
67
|
+
- name: Checkout repository
|
|
68
|
+
uses: actions/checkout@v5
|
|
69
|
+
|
|
70
|
+
# Test our setup-node-and-install action across different environments
|
|
71
|
+
- name: Setup Node.js and install dependencies
|
|
72
|
+
uses: ./setup-node-and-install
|
|
73
|
+
with:
|
|
74
|
+
node-version: ${{ matrix.node-version }}
|
|
75
|
+
|
|
76
|
+
- name: Verify Node.js version
|
|
77
|
+
run: node --version
|
|
78
|
+
|
|
79
|
+
- name: Run basic tests
|
|
80
|
+
run: pnpm test
|
|
81
|
+
|
|
82
|
+
integration-test:
|
|
83
|
+
name: Integration Test - Publish PR Package
|
|
84
|
+
runs-on: ubuntu-latest
|
|
85
|
+
if: github.event_name == 'pull_request_target'
|
|
86
|
+
|
|
87
|
+
permissions:
|
|
88
|
+
pull-requests: write
|
|
89
|
+
|
|
90
|
+
steps:
|
|
91
|
+
- name: Checkout repository
|
|
92
|
+
uses: actions/checkout@v5
|
|
93
|
+
|
|
94
|
+
- name: Setup Node.js and install dependencies
|
|
95
|
+
uses: ./setup-node-and-install
|
|
96
|
+
with:
|
|
97
|
+
node-version: 'lts/*'
|
|
98
|
+
|
|
99
|
+
# Create a test package to publish
|
|
100
|
+
- name: Create test package
|
|
101
|
+
run: |
|
|
102
|
+
mkdir -p test-package
|
|
103
|
+
cd test-package
|
|
104
|
+
cat > package.json <<EOF
|
|
105
|
+
{
|
|
106
|
+
"name": "@codfish/actions-test-package",
|
|
107
|
+
"version": "1.0.0",
|
|
108
|
+
"description": "Test package for GitHub Actions validation",
|
|
109
|
+
"main": "index.js",
|
|
110
|
+
"private": false
|
|
111
|
+
}
|
|
112
|
+
EOF
|
|
113
|
+
echo "module.exports = { test: true };" > index.js
|
|
114
|
+
|
|
115
|
+
# Test our npm-pr-version action (but don't actually publish to avoid spam)
|
|
116
|
+
- name: Test PR version generation
|
|
117
|
+
working-directory: test-package
|
|
118
|
+
env:
|
|
119
|
+
# Don't actually publish by not providing npm-token
|
|
120
|
+
PR: ${{ github.event.number }}
|
|
121
|
+
SHA: ${{ github.event.pull_request.head.sha }}
|
|
122
|
+
run: |
|
|
123
|
+
# Test the version generation logic
|
|
124
|
+
version="0.0.0-PR-${PR}--$(echo ${SHA} | cut -c -7)"
|
|
125
|
+
echo "Generated version: $version"
|
|
126
|
+
|
|
127
|
+
# Test package.json update
|
|
128
|
+
npm version $version --no-git-tag-version
|
|
129
|
+
|
|
130
|
+
# Verify the version was set correctly
|
|
131
|
+
node -e "console.log('Package version:', require('./package.json').version)"
|
|
132
|
+
|
|
133
|
+
# Set output for comment
|
|
134
|
+
echo "version=$version" >> $GITHUB_OUTPUT
|
|
135
|
+
id: version-test
|
|
136
|
+
|
|
137
|
+
# Dogfood our comment action to report results
|
|
138
|
+
- name: Report integration test results
|
|
139
|
+
uses: ./comment
|
|
140
|
+
with:
|
|
141
|
+
message: |
|
|
142
|
+
## 🚀 Integration Test Results
|
|
143
|
+
|
|
144
|
+
**npm-pr-version action test:**
|
|
145
|
+
- ✅ Version generation: ${{ steps.version-test.outputs.version }}
|
|
146
|
+
- ✅ package.json update: Successful
|
|
147
|
+
- ✅ Format validation: Passed
|
|
148
|
+
|
|
149
|
+
The action is working correctly! 🎉
|
|
150
|
+
tag: integration-test-results
|
|
151
|
+
upsert: true
|
|
152
|
+
|
|
153
|
+
validate-action-metadata:
|
|
154
|
+
name: Validate Action Metadata
|
|
155
|
+
runs-on: ubuntu-latest
|
|
156
|
+
|
|
157
|
+
steps:
|
|
158
|
+
- name: Checkout repository
|
|
159
|
+
uses: actions/checkout@v5
|
|
160
|
+
|
|
161
|
+
- name: Validate action.yml files
|
|
162
|
+
run: |
|
|
163
|
+
echo "Validating action.yml files..."
|
|
164
|
+
|
|
165
|
+
for action_dir in */; do
|
|
166
|
+
if [ -f "${action_dir}action.yml" ]; then
|
|
167
|
+
echo "✅ Found action.yml in $action_dir"
|
|
168
|
+
|
|
169
|
+
# Basic YAML validation
|
|
170
|
+
if ! python3 -c "import yaml; yaml.safe_load(open('${action_dir}action.yml'))" 2>/dev/null; then
|
|
171
|
+
echo "❌ Invalid YAML in ${action_dir}action.yml"
|
|
172
|
+
exit 1
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
# Check for required fields
|
|
176
|
+
if ! grep -q "^name:" "${action_dir}action.yml"; then
|
|
177
|
+
echo "❌ Missing 'name' field in ${action_dir}action.yml"
|
|
178
|
+
exit 1
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
if ! grep -q "^description:" "${action_dir}action.yml"; then
|
|
182
|
+
echo "❌ Missing 'description' field in ${action_dir}action.yml"
|
|
183
|
+
exit 1
|
|
184
|
+
fi
|
|
185
|
+
|
|
186
|
+
echo "✅ ${action_dir}action.yml is valid"
|
|
187
|
+
else
|
|
188
|
+
echo "⚠️ No action.yml found in $action_dir"
|
|
189
|
+
fi
|
|
190
|
+
done
|
|
191
|
+
|
|
192
|
+
- name: Validate README files
|
|
193
|
+
run: |
|
|
194
|
+
echo "Validating README files..."
|
|
195
|
+
|
|
196
|
+
for action_dir in */; do
|
|
197
|
+
if [ -f "${action_dir}README.md" ]; then
|
|
198
|
+
echo "✅ Found README.md in $action_dir"
|
|
199
|
+
|
|
200
|
+
# Check for basic sections
|
|
201
|
+
if ! grep -q "# " "${action_dir}README.md"; then
|
|
202
|
+
echo "❌ Missing main heading in ${action_dir}README.md"
|
|
203
|
+
exit 1
|
|
204
|
+
fi
|
|
205
|
+
|
|
206
|
+
echo "✅ ${action_dir}README.md looks good"
|
|
207
|
+
else
|
|
208
|
+
echo "⚠️ No README.md found in $action_dir"
|
|
209
|
+
fi
|
|
210
|
+
done
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
24.8.0
|
package/AGENT.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# AGENT.md
|
|
2
|
+
|
|
3
|
+
<!-- DOCTOC SKIP -->
|
|
4
|
+
|
|
5
|
+
This file provides guidance to AI agents when working with code in this repository.
|
|
6
|
+
|
|
7
|
+
## Project Overview
|
|
8
|
+
|
|
9
|
+
This repository contains reusable GitHub Actions for use across multiple projects. Each action is self-contained in its
|
|
10
|
+
own directory at the root level.
|
|
11
|
+
|
|
12
|
+
## Package Manager
|
|
13
|
+
|
|
14
|
+
This project uses **pnpm** as the package manager. All commands should use pnpm:
|
|
15
|
+
|
|
16
|
+
- Install dependencies: `pnpm install`
|
|
17
|
+
- Run tests: `pnpm test`
|
|
18
|
+
- Run linting: `pnpm lint`
|
|
19
|
+
- Format code: `pnpm format`
|
|
20
|
+
- Generate documentation: `pnpm docs:generate`
|
|
21
|
+
- Run specific test types: `pnpm test:integration`, `pnpm test:unit`
|
|
22
|
+
|
|
23
|
+
## Code Quality Workflow
|
|
24
|
+
|
|
25
|
+
**IMPORTANT**: Always run the appropriate command after making file changes:
|
|
26
|
+
|
|
27
|
+
- **For JS/TS/TSX/JSX/YML/YAML files**: Run `pnpm fix` to apply ESLint fixes (CRITICAL for YAML files to prevent
|
|
28
|
+
formatting issues)
|
|
29
|
+
- **For JSON/MD/CSS files**: Run `pnpm format` to apply Prettier formatting
|
|
30
|
+
- **When in doubt**: Run both commands in sequence
|
|
31
|
+
|
|
32
|
+
## Action Structure
|
|
33
|
+
|
|
34
|
+
- Action names: lowercase kebab-case (e.g., `npm-publish-pr`)
|
|
35
|
+
- Each action directory contains:
|
|
36
|
+
- `action.yml` - Action definition and metadata
|
|
37
|
+
- Implementation files (JavaScript/TypeScript as needed)
|
|
38
|
+
- `README.md` - Action-specific documentation
|
|
39
|
+
|
|
40
|
+
## Development Guidelines
|
|
41
|
+
|
|
42
|
+
- Actions should be standalone and reusable across different projects
|
|
43
|
+
- Follow GitHub Actions best practices for inputs, outputs, and error handling
|
|
44
|
+
- Use semantic action names that clearly describe their purpose
|
|
45
|
+
- Each action should handle its own dependencies and setup requirements
|
|
46
|
+
- All actions support multiple package managers (npm/yarn/pnpm) when applicable
|
|
47
|
+
- Use comprehensive input validation with clear error messages
|
|
48
|
+
- Include proper error handling and informative logging
|
|
49
|
+
|
|
50
|
+
## Security Best Practices
|
|
51
|
+
|
|
52
|
+
- **File Operations**: Use file descriptors (`fs.openSync()`, `fs.readSync()`, `fs.writeSync()`) instead of file names
|
|
53
|
+
(`fs.readFileSync()`, `fs.writeFileSync()`) to prevent TOCTOU (Time-of-Check-Time-of-Use) vulnerabilities
|
|
54
|
+
- **Resource Management**: Always close file descriptors in `finally` blocks to prevent resource leaks
|
|
55
|
+
- **Atomic Operations**: Keep file descriptors open during entire read-modify-write operations to prevent race
|
|
56
|
+
conditions
|
|
57
|
+
|
|
58
|
+
## Current Actions
|
|
59
|
+
|
|
60
|
+
- `npm-pr-version` - Publishes packages with PR-specific version numbers using detected package manager (npm/yarn/pnpm)
|
|
61
|
+
for testing in downstream apps before merging
|
|
62
|
+
- `comment` - Creates or updates pull request comments with intelligent upsert functionality using unique tags
|
|
63
|
+
- **IMPORTANT**: Any job using the comment action must include `permissions: pull-requests: write`
|
|
64
|
+
- `setup-node-and-install` - Sets up Node.js environment and installs dependencies with automatic package manager
|
|
65
|
+
detection, intelligent caching, and .nvmrc/.node-version support
|
|
66
|
+
|
|
67
|
+
## Testing
|
|
68
|
+
|
|
69
|
+
The project includes comprehensive testing infrastructure:
|
|
70
|
+
|
|
71
|
+
- **Integration tests**: Test full action workflows using bats
|
|
72
|
+
- **Test fixtures**: Reusable test data for different scenarios
|
|
73
|
+
- **CI/CD validation**: Dogfooding actions in GitHub workflows
|
|
74
|
+
- **Multi-platform testing**: Ubuntu, Windows, macOS support
|
|
75
|
+
|
|
76
|
+
Run tests with: `pnpm test`
|
|
77
|
+
|
|
78
|
+
**Cross-Platform Notes:**
|
|
79
|
+
|
|
80
|
+
- Test scripts use `bash` prefix for Windows compatibility
|
|
81
|
+
- All npm scripts should work on Windows, macOS, and Linux
|
|
82
|
+
- Bats tests require bash to be available (included in Git for Windows)
|
|
83
|
+
|
|
84
|
+
## Documentation System
|
|
85
|
+
|
|
86
|
+
### Automated Documentation Generation
|
|
87
|
+
|
|
88
|
+
- Run `pnpm docs:generate` to update all documentation
|
|
89
|
+
- The script automatically:
|
|
90
|
+
1. Updates main README.md with action overview using `<!-- start action docs -->` / `<!-- end action docs -->` markers
|
|
91
|
+
2. Updates individual action README files with inputs/outputs tables using `<!-- start inputs -->` /
|
|
92
|
+
`<!-- end inputs -->` and `<!-- start outputs -->` / `<!-- end outputs -->` markers
|
|
93
|
+
3. Runs prettier formatting on all updated documentation
|
|
94
|
+
|
|
95
|
+
### Documentation Markers
|
|
96
|
+
|
|
97
|
+
- **Main README.md**: Uses `<!-- start action docs -->` and `<!-- end action docs -->` for the Available Actions section
|
|
98
|
+
- **Action README files**: Uses `<!-- start inputs -->` / `<!-- end inputs -->` for inputs tables and
|
|
99
|
+
`<!-- start outputs -->` / `<!-- end outputs -->` for outputs tables
|
|
100
|
+
- **CRITICAL: NEVER EDIT AUTO-GENERATED CONTENT**: Never modify content between ANY HTML comment markers in README
|
|
101
|
+
files:
|
|
102
|
+
- `<!-- START doctoc generated TOC please keep comment here to allow auto update -->` and
|
|
103
|
+
`<!-- END doctoc generated TOC please keep comment here to allow auto update -->` (doctoc table of contents)
|
|
104
|
+
- `<!-- start action docs -->` and `<!-- end action docs -->` (main README action documentation)
|
|
105
|
+
- `<!-- start inputs -->` and `<!-- end inputs -->` (action inputs tables)
|
|
106
|
+
- `<!-- start outputs -->` and `<!-- end outputs -->` (action outputs tables)
|
|
107
|
+
- Any other `<!-- ... -->` comment markers - they indicate auto-generated content
|
|
108
|
+
- All content outside these markers is manually maintained and can be edited
|
|
109
|
+
- **Prettier Protection**: Doctoc blocks are wrapped in `<!-- prettier-ignore-start -->` and
|
|
110
|
+
`<!-- prettier-ignore-end -->` to prevent formatting
|
|
111
|
+
|
|
112
|
+
### Workflow Automation
|
|
113
|
+
|
|
114
|
+
- `.github/workflows/update-docs.yml` automatically runs on changes to `*/action.yml` or `bin/generate-docs.js`
|
|
115
|
+
- Uses `stefanzweifel/git-auto-commit-action` to commit documentation changes
|
|
116
|
+
- Handles both main README.md and all action README files
|
|
117
|
+
- Automatically formats all documentation using prettier
|
|
118
|
+
|
|
119
|
+
## Security
|
|
120
|
+
|
|
121
|
+
The project implements multiple security measures:
|
|
122
|
+
|
|
123
|
+
- **Dependabot**: Automated dependency updates
|
|
124
|
+
- **CodeQL**: Static security analysis
|
|
125
|
+
- **Secret scanning**: TruffleHog for committed secrets (uses default behavior without base/head commits for better
|
|
126
|
+
compatibility)
|
|
127
|
+
- **Vulnerability auditing**: Regular pnpm audit checks
|
|
128
|
+
- **Note**: Dependency review requires GitHub Advanced Security (available free on public repos, paid feature for
|
|
129
|
+
private repos)
|
package/CLAUDE.md
ADDED