code-foundry 0.24.1 → 0.26.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.
@@ -1,246 +0,0 @@
1
- name: Code Foundry CodeQL
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- runtime-repository:
7
- description: Repository containing the Code Foundry runtime.
8
- required: false
9
- type: string
10
- default: 0xPlayerOne/code-foundry
11
- runtime-ref:
12
- description: Code Foundry runtime tag or ref.
13
- required: false
14
- type: string
15
- default: v0.20.2
16
- runner:
17
- description: Runner used by CodeQL jobs.
18
- required: false
19
- type: string
20
- default: ubuntu-latest
21
-
22
- permissions:
23
- actions: read
24
- contents: read
25
- packages: read
26
- security-events: write
27
-
28
- env:
29
- REPO_FOUNDRY_PROFILE: ${{ vars.REPO_FOUNDRY_PROFILE }}
30
- REPO_FOUNDRY_LANGUAGES: ${{ vars.REPO_FOUNDRY_LANGUAGES }}
31
- REPO_FOUNDRY_FEATURES: ${{ vars.REPO_FOUNDRY_FEATURES }}
32
-
33
- concurrency:
34
- group: ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.event.pull_request.head.ref || github.ref_name }}
35
- cancel-in-progress: true
36
-
37
- jobs:
38
- detect:
39
- name: Detect
40
- runs-on: ${{ inputs.runner }}
41
- timeout-minutes: 10
42
- outputs:
43
- languages: ${{ steps.languages.outputs.languages }}
44
- code_security: ${{ steps.security.outputs.status }}
45
- actions_available: ${{ steps.languages.outputs.actions_available }}
46
- actions_changed: ${{ steps.languages.outputs.actions_changed }}
47
- actions_build_mode: ${{ steps.languages.outputs.actions_build_mode }}
48
- javascript_available: ${{ steps.languages.outputs.javascript_available }}
49
- javascript_changed: ${{ steps.languages.outputs.javascript_changed }}
50
- javascript_build_mode: ${{ steps.languages.outputs.javascript_build_mode }}
51
- python_available: ${{ steps.languages.outputs.python_available }}
52
- python_changed: ${{ steps.languages.outputs.python_changed }}
53
- python_build_mode: ${{ steps.languages.outputs.python_build_mode }}
54
- rust_available: ${{ steps.languages.outputs.rust_available }}
55
- rust_changed: ${{ steps.languages.outputs.rust_changed }}
56
- rust_build_mode: ${{ steps.languages.outputs.rust_build_mode }}
57
- steps:
58
- - name: Detect Code Security
59
- id: security
60
- env:
61
- GH_TOKEN: ${{ github.token }}
62
- run: |
63
- status="disabled"
64
- if [ "${{ github.event.repository.private }}" != "true" ]; then
65
- status="enabled"
66
- else
67
- status="$(gh api "repos/${GITHUB_REPOSITORY}" --jq '.security_and_analysis.code_security.status // "disabled"' 2>/dev/null || printf 'disabled')"
68
- fi
69
- printf 'status=%s\n' "$status" >> "$GITHUB_OUTPUT"
70
- - name: Checkout
71
- if: ${{ !github.event.repository.private || steps.security.outputs.status == 'enabled' }}
72
- uses: actions/checkout@v7
73
- with:
74
- fetch-depth: 2
75
- filter: blob:none
76
- sparse-checkout: |
77
- .github
78
- .mise.toml
79
- mise.lock
80
- package.json
81
- bun.lock
82
- bun.lockb
83
- pnpm-lock.yaml
84
- yarn.lock
85
- package-lock.json
86
- sparse-checkout-cone-mode: false
87
- - name: Runtime
88
- if: ${{ !github.event.repository.private || steps.security.outputs.status == 'enabled' }}
89
- uses: actions/checkout@v7
90
- with:
91
- repository: ${{ inputs.runtime-repository }}
92
- ref: ${{ inputs.runtime-ref }}
93
- path: .code-foundry
94
- sparse-checkout: |
95
- .github/actions
96
- .github/scripts
97
- - name: Install runtime
98
- if: ${{ !github.event.repository.private || steps.security.outputs.status == 'enabled' }}
99
- run: |
100
- mkdir -p .github/actions .github/scripts
101
- cp -R .code-foundry/.github/actions/. .github/actions/
102
- cp -R .code-foundry/.github/scripts/. .github/scripts/
103
- - id: languages
104
- name: Detect languages
105
- env:
106
- CODEQL_BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
107
- REPO_FOUNDRY_CODE_SECURITY: ${{ steps.security.outputs.status }}
108
- REPO_FOUNDRY_PRIVATE: ${{ github.event.repository.private }}
109
- run: |
110
- if [ "$REPO_FOUNDRY_PRIVATE" = "true" ] && [ "$REPO_FOUNDRY_CODE_SECURITY" != "enabled" ]; then
111
- echo 'languages=[]' >> "$GITHUB_OUTPUT"
112
- else
113
- bash .github/scripts/codeql-languages.sh
114
- fi
115
-
116
- analyze-actions:
117
- name: Analyze (Actions)
118
- needs: detect
119
- if: >-
120
- ( !github.event.repository.private || needs.detect.outputs.code_security == 'enabled' ) &&
121
- needs.detect.outputs.actions_available == 'true' &&
122
- needs.detect.outputs.actions_changed == 'true'
123
- runs-on: ${{ inputs.runner }}
124
- timeout-minutes: 30
125
- steps:
126
- - name: Checkout
127
- uses: actions/checkout@v7
128
- - name: Runtime
129
- uses: actions/checkout@v7
130
- with:
131
- repository: ${{ inputs.runtime-repository }}
132
- ref: ${{ inputs.runtime-ref }}
133
- path: .code-foundry
134
- sparse-checkout: |
135
- .github/actions
136
- .github/scripts
137
- - name: Install runtime
138
- run: |
139
- mkdir -p .github/actions .github/scripts
140
- cp -R .code-foundry/.github/actions/. .github/actions/
141
- cp -R .code-foundry/.github/scripts/. .github/scripts/
142
- - name: Analyze
143
- uses: ./.github/actions/codeql
144
- with:
145
- language: actions
146
- build-mode: ${{ needs.detect.outputs.actions_build_mode }}
147
- category: /language:actions
148
-
149
- analyze-typescript:
150
- name: Analyze (TypeScript)
151
- needs: detect
152
- if: >-
153
- ( !github.event.repository.private || needs.detect.outputs.code_security == 'enabled' ) &&
154
- needs.detect.outputs.javascript_available == 'true' &&
155
- needs.detect.outputs.javascript_changed == 'true'
156
- runs-on: ${{ inputs.runner }}
157
- timeout-minutes: 30
158
- steps:
159
- - name: Checkout
160
- uses: actions/checkout@v7
161
- - name: Runtime
162
- uses: actions/checkout@v7
163
- with:
164
- repository: ${{ inputs.runtime-repository }}
165
- ref: ${{ inputs.runtime-ref }}
166
- path: .code-foundry
167
- sparse-checkout: |
168
- .github/actions
169
- .github/scripts
170
- - name: Install runtime
171
- run: |
172
- mkdir -p .github/actions .github/scripts
173
- cp -R .code-foundry/.github/actions/. .github/actions/
174
- cp -R .code-foundry/.github/scripts/. .github/scripts/
175
- - name: Analyze
176
- uses: ./.github/actions/codeql
177
- with:
178
- language: javascript-typescript
179
- build-mode: ${{ needs.detect.outputs.javascript_build_mode }}
180
- category: /language:javascript-typescript
181
-
182
- analyze-python:
183
- name: Analyze (Python)
184
- needs: detect
185
- if: >-
186
- ( !github.event.repository.private || needs.detect.outputs.code_security == 'enabled' ) &&
187
- needs.detect.outputs.python_available == 'true' &&
188
- needs.detect.outputs.python_changed == 'true'
189
- runs-on: ${{ inputs.runner }}
190
- timeout-minutes: 30
191
- steps:
192
- - name: Checkout
193
- uses: actions/checkout@v7
194
- - name: Runtime
195
- uses: actions/checkout@v7
196
- with:
197
- repository: ${{ inputs.runtime-repository }}
198
- ref: ${{ inputs.runtime-ref }}
199
- path: .code-foundry
200
- sparse-checkout: |
201
- .github/actions
202
- .github/scripts
203
- - name: Install runtime
204
- run: |
205
- mkdir -p .github/actions .github/scripts
206
- cp -R .code-foundry/.github/actions/. .github/actions/
207
- cp -R .code-foundry/.github/scripts/. .github/scripts/
208
- - name: Analyze
209
- uses: ./.github/actions/codeql
210
- with:
211
- language: python
212
- build-mode: ${{ needs.detect.outputs.python_build_mode }}
213
- category: /language:python
214
-
215
- analyze-rust:
216
- name: Analyze (Rust)
217
- needs: detect
218
- if: >-
219
- ( !github.event.repository.private || needs.detect.outputs.code_security == 'enabled' ) &&
220
- needs.detect.outputs.rust_available == 'true' &&
221
- needs.detect.outputs.rust_changed == 'true'
222
- runs-on: ${{ inputs.runner }}
223
- timeout-minutes: 30
224
- steps:
225
- - name: Checkout
226
- uses: actions/checkout@v7
227
- - name: Runtime
228
- uses: actions/checkout@v7
229
- with:
230
- repository: ${{ inputs.runtime-repository }}
231
- ref: ${{ inputs.runtime-ref }}
232
- path: .code-foundry
233
- sparse-checkout: |
234
- .github/actions
235
- .github/scripts
236
- - name: Install runtime
237
- run: |
238
- mkdir -p .github/actions .github/scripts
239
- cp -R .code-foundry/.github/actions/. .github/actions/
240
- cp -R .code-foundry/.github/scripts/. .github/scripts/
241
- - name: Analyze
242
- uses: ./.github/actions/codeql
243
- with:
244
- language: rust
245
- build-mode: ${{ needs.detect.outputs.rust_build_mode }}
246
- category: /language:rust
@@ -1,57 +0,0 @@
1
- name: Code Foundry Draft PR
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- runner:
7
- description: Runner used to create the draft PR.
8
- required: false
9
- type: string
10
- default: ubuntu-slim
11
-
12
- permissions:
13
- contents: read
14
- pull-requests: write
15
-
16
- env:
17
- GH_TOKEN: ${{ github.token }}
18
-
19
- jobs:
20
- create-draft-pr:
21
- name: Create
22
- runs-on: ${{ inputs.runner }}
23
- timeout-minutes: 10
24
- concurrency:
25
- group: ${{ github.workflow }}-${{ github.ref }}
26
- cancel-in-progress: true
27
- steps:
28
- - name: Check
29
- id: check-pr
30
- run: |
31
- BRANCH="${{ github.ref_name }}"
32
- EXISTING=$(gh pr list --limit 1 --base staging --head "$BRANCH" --state open --json number,title 2>/dev/null | jq 'length')
33
- echo "existing=$EXISTING" >> "$GITHUB_OUTPUT"
34
-
35
- - name: Create
36
- if: steps.check-pr.outputs.existing == '0'
37
- run: |
38
- BRANCH="${{ github.ref_name }}"
39
- gh pr create \
40
- --base staging \
41
- --head "$BRANCH" \
42
- --draft \
43
- --title "[WIP] $BRANCH" \
44
- --body "Draft PR created automatically by CI.
45
-
46
- This PR is a draft and should not be merged until CI passes and a reviewer (or the Daily Review agent) marks it ready.
47
-
48
- **CI Status:** Pending — this workflow triggered on push to \`$BRANCH\`."
49
-
50
- - name: Mark ready
51
- if: steps.check-pr.outputs.existing == '0'
52
- run: |
53
- BRANCH="${{ github.ref_name }}"
54
- PR_NUMBER=$(gh pr list --limit 1 --base staging --head "$BRANCH" --state open --json number 2>/dev/null | jq '.[0].number')
55
- if [ -n "$PR_NUMBER" ]; then
56
- gh pr ready "$PR_NUMBER"
57
- fi
@@ -1,99 +0,0 @@
1
- name: Code Foundry Release PR
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- runner:
7
- description: Runner used to create the release PR.
8
- required: false
9
- type: string
10
- default: ubuntu-slim
11
-
12
- permissions:
13
- contents: read
14
- pull-requests: write
15
-
16
- env:
17
- GH_TOKEN: ${{ github.token }}
18
-
19
- jobs:
20
- create-release-pr:
21
- name: Create
22
- runs-on: ${{ inputs.runner }}
23
- timeout-minutes: 10
24
- concurrency:
25
- group: ${{ github.workflow }}-${{ github.ref }}
26
- cancel-in-progress: true
27
- steps:
28
- - name: Check
29
- id: check-pr
30
- run: |
31
- set -euo pipefail
32
- EXISTING=$(gh pr list \
33
- --repo "$GITHUB_REPOSITORY" \
34
- --limit 1 \
35
- --base main \
36
- --head staging \
37
- --state open \
38
- --json number | jq 'length')
39
- COMPARE_URL="repos/${GITHUB_REPOSITORY}/compare/main...staging"
40
- TOTAL_COMMITS=$(gh api "$COMPARE_URL?per_page=1" --jq '.total_commits // 0')
41
- echo "existing=$EXISTING" >> "$GITHUB_OUTPUT"
42
- echo "commits=$TOTAL_COMMITS" >> "$GITHUB_OUTPUT"
43
-
44
- - name: No changes
45
- if: steps.check-pr.outputs.existing == '0' && steps.check-pr.outputs.commits == '0'
46
- run: echo 'staging is already aligned with main; no promotion PR is needed.'
47
-
48
- - name: Create
49
- if: steps.check-pr.outputs.existing == '0' && steps.check-pr.outputs.commits != '0'
50
- run: |
51
- DATE=$(date +%Y-%m-%d)
52
- BODY_FILE="$RUNNER_TEMP/release-pr.md"
53
- COMPARE_URL="repos/${GITHUB_REPOSITORY}/compare/main...staging"
54
- COMPARE_FILE="$RUNNER_TEMP/release-compare.json"
55
- gh api "$COMPARE_URL?per_page=100" > "$COMPARE_FILE"
56
- TOTAL_COMMITS=$(jq -r '.total_commits // 0' "$COMPARE_FILE")
57
- if [ "$TOTAL_COMMITS" -gt 100 ]; then
58
- LAST_PAGE=$(( (TOTAL_COMMITS + 99) / 100 ))
59
- gh api "$COMPARE_URL?per_page=100&page=$LAST_PAGE" > "$COMPARE_FILE"
60
- fi
61
- COMMITS=$(jq -r '.commits[] | "- \(.commit.message | split("\\n")[0]) (\(.sha[0:7]))"' "$COMPARE_FILE")
62
- if [ -z "$COMMITS" ]; then
63
- COMMITS='- No commits found since main.'
64
- fi
65
-
66
- if [ "$TOTAL_COMMITS" -eq 1 ]; then
67
- CHANGE_LABEL=change
68
- else
69
- CHANGE_LABEL=changes
70
- fi
71
-
72
- cat > "$BODY_FILE" <<EOF
73
- ## Environment promotion
74
-
75
- Promote the validated \`staging\` environment into \`main\`.
76
- This is a deployment-promotion PR, not the version-release PR.
77
-
78
- - **Source:** \`staging\`
79
- - **Target:** \`main\`
80
- - **Changes:** $TOTAL_COMMITS $CHANGE_LABEL
81
- - **Created:** $DATE
82
-
83
- ### Commit summary
84
-
85
- $COMMITS
86
-
87
- ### Validation
88
-
89
- - Required CI, test, security, and CodeQL checks must pass before merge.
90
- - Merge with **rebase** to preserve the linear Conventional Commit history.
91
- - After merge, Release Please opens a separate versioned release PR with the changelog.
92
- EOF
93
-
94
- gh pr create \
95
- --repo "$GITHUB_REPOSITORY" \
96
- --base main \
97
- --head staging \
98
- --title "Promote staging -> main ($DATE)" \
99
- --body-file "$BODY_FILE"
@@ -1,117 +0,0 @@
1
- name: Code Foundry Release
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- runner:
7
- description: Runner used by release jobs.
8
- required: false
9
- type: string
10
- default: ubuntu-slim
11
-
12
- permissions:
13
- contents: write
14
- issues: write
15
- pull-requests: write
16
-
17
- env:
18
- REPO_FOUNDRY_PROFILE: ${{ vars.REPO_FOUNDRY_PROFILE }}
19
- REPO_FOUNDRY_LANGUAGES: ${{ vars.REPO_FOUNDRY_LANGUAGES }}
20
- REPO_FOUNDRY_FEATURES: ${{ vars.REPO_FOUNDRY_FEATURES }}
21
- REPO_FOUNDRY_PACKAGE_MANAGER: ${{ vars.REPO_FOUNDRY_PACKAGE_MANAGER }}
22
- REPO_FOUNDRY_RELEASE_TYPE: ${{ vars.REPO_FOUNDRY_RELEASE_TYPE }}
23
- REPO_FOUNDRY_NPM_PUBLISH: ${{ vars.REPO_FOUNDRY_NPM_PUBLISH }}
24
-
25
- jobs:
26
- release:
27
- name: Release / Version
28
- runs-on: ${{ inputs.runner }}
29
- timeout-minutes: 20
30
- concurrency:
31
- group: ${{ github.workflow }}-${{ github.ref }}
32
- cancel-in-progress: false
33
- outputs:
34
- release_created: ${{ steps.release.outputs.release_created || 'false' }}
35
- tag_name: ${{ steps.release.outputs.tag_name }}
36
- npm_publish: ${{ steps.profile.outputs.npm_publish }}
37
- steps:
38
- - name: Checkout
39
- uses: actions/checkout@v7
40
- with:
41
- filter: blob:none
42
- - name: Detect release profile
43
- id: profile
44
- shell: bash
45
- run: |
46
- if [ -x .github/scripts/profile.sh ]; then
47
- release_type="$(bash .github/scripts/profile.sh get release_type)"
48
- npm_publish="$(bash .github/scripts/profile.sh get npm_publish)"
49
- else
50
- config_file=.github/code-foundry.yml
51
- release_type="$(awk -F': ' '/^release_type:/ {print $2; exit}' "$config_file" 2>/dev/null || true)"
52
- npm_publish="$(awk -F': ' '/^npm_publish:/ {print $2; exit}' "$config_file" 2>/dev/null || true)"
53
- fi
54
- [ -n "$release_type" ] || release_type=auto
55
- [ -n "$npm_publish" ] || npm_publish=false
56
-
57
- if [ "$release_type" = auto ]; then
58
- if [ -f package.json ]; then release_type=node
59
- elif [ -f pyproject.toml ]; then release_type=python
60
- elif [ -f Cargo.toml ]; then release_type=rust
61
- elif [ -f version.txt ]; then release_type=simple
62
- else release_type=none
63
- fi
64
- fi
65
-
66
- case "$release_type" in
67
- node|python|rust|simple) ;;
68
- none) npm_publish=false ;;
69
- *) echo "Unsupported release_type: $release_type" >&2; exit 2 ;;
70
- esac
71
- if [ ! -f package.json ]; then npm_publish=false; fi
72
- printf 'release_type=%s\n' "$release_type" >> "$GITHUB_OUTPUT"
73
- printf 'npm_publish=%s\n' "$npm_publish" >> "$GITHUB_OUTPUT"
74
- - name: Release Please
75
- id: release
76
- if: steps.profile.outputs.release_type != 'none'
77
- uses: googleapis/release-please-action@v5
78
- with:
79
- token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
80
- config-file: release-please-config.json
81
- release-type: ${{ steps.profile.outputs.release_type }}
82
-
83
- npm:
84
- name: Release / Publish npm
85
- needs: release
86
- if: needs.release.outputs.release_created == 'true' && needs.release.outputs.npm_publish == 'true'
87
- runs-on: ${{ inputs.runner }}
88
- timeout-minutes: 15
89
- permissions:
90
- contents: read
91
- id-token: write
92
- env:
93
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
94
- steps:
95
- - name: Checkout release
96
- uses: actions/checkout@v7
97
- with:
98
- ref: ${{ needs.release.outputs.tag_name }}
99
- - name: Setup Node (trusted)
100
- if: env.NPM_TOKEN == ''
101
- uses: actions/setup-node@v5
102
- with:
103
- node-version: 24
104
- - name: Setup Node (token)
105
- if: env.NPM_TOKEN != ''
106
- uses: actions/setup-node@v5
107
- with:
108
- node-version: 24
109
- registry-url: https://registry.npmjs.org
110
- - name: Publish npm with token
111
- if: env.NPM_TOKEN != ''
112
- env:
113
- NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
114
- run: npm publish --provenance --access public
115
- - name: Publish npm with trusted publishing
116
- if: env.NPM_TOKEN == ''
117
- run: npm publish --provenance --access public