Skip to content
Merged
12 changes: 6 additions & 6 deletions .castiron.stats.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
schema_version: 1
generation_id: 14743cd4-a53e-4fed-ba72-d5e23592153e
openapi_spec_hash: a99ded1ea34cf528a9cd5f064167f26a
openapi_transformed_spec_hash: e24c9d9339620c3cce8bbdd80e9ef8ed
generation_id: ddf51c0b-5978-487f-be21-e379112a927a
openapi_spec_hash: a85edbfc22ff719d064bce2705c7394e
openapi_transformed_spec_hash: f8e7644df5aee22dfcd0ea2b70942054
config_hash: 85382dd94c503b5d225adc7636a77c9f
codegen_sha: 66cd6dedd5d1b60732d891f911deb07347a8f068
codegen_hash: 0e1cb892e3631438e55b55edd14899551f458be8d073e13d2c191730297562d6
public_codegen_sha: 6356986f823c01fd602da9f64ef414c01db4619c
codegen_sha: 310aa46b5b69a9e4a3d0dd78fa47797d6cae2746
codegen_hash: 5188f6aac875d009719a2f3702c2824068b7ce0780fe001f8a791735d8212a8b
public_codegen_sha: 0d3e70da47bb645fbfd0dd16fdd37ea10ee981f5
85 changes: 65 additions & 20 deletions .github/workflows/castiron-custom-code-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,63 @@ concurrency:
cancel-in-progress: false

jobs:
compute:
name: Compute trusted custom-code report
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.path == '.github/workflows/castiron-custom-code.yml'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
actions: read
pull-requests: read
outputs:
number: ${{ steps.report.outputs.number }}
artifact-id: ${{ steps.artifact.outputs.artifact-id }}
artifact-run-attempt: ${{ github.run_attempt }}
steps:
- name: Check out the trusted reporter
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.workflow_sha }}
persist-credentials: false

- name: Compute from the current pull request Git objects
id: report
env:
GH_TOKEN: ${{ github.token }}
GIT_CONFIG_COUNT: '2'
GIT_CONFIG_KEY_0: credential.helper
GIT_CONFIG_VALUE_0: ''
GIT_CONFIG_KEY_1: credential.https://github.com.helper
GIT_CONFIG_VALUE_1: '!gh auth git-credential'
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.event.workflow_run.id }}
RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
run: |
python3 -I scripts/castiron/custom_code_report.py trusted-report \
--repo "$RUNNER_TEMP/castiron-objects.git" \
--repository "$REPOSITORY" --run-id "$RUN_ID" --run-attempt "$RUN_ATTEMPT" \
--out "$RUNNER_TEMP/castiron-custom-code"
if test -f "$RUNNER_TEMP/castiron-custom-code/context.json"; then
number=$(jq -er '.pr' "$RUNNER_TEMP/castiron-custom-code/context.json")
printf 'number=%s\n' "$number" >> "$GITHUB_OUTPUT"
cat "$RUNNER_TEMP/castiron-custom-code/summary.md" >> "$GITHUB_STEP_SUMMARY"
fi

- name: Upload the trusted report and patch
id: artifact
if: steps.report.outputs.number != ''
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: castiron-custom-code-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/castiron-custom-code/
if-no-files-found: error
retention-days: 7

comment:
name: Update custom-code comment
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.path == '.github/workflows/castiron-custom-code.yml'
needs: compute
if: always() && !cancelled() && (needs.compute.result == 'failure' || needs.compute.outputs.number != '')
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
Expand All @@ -29,40 +83,31 @@ jobs:
ref: ${{ github.workflow_sha }}
persist-credentials: false

- name: Download the completed run's report
- name: Download this workflow's trusted report
if: needs.compute.result == 'success'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
name: castiron-custom-code-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
artifact-ids: ${{ needs.compute.outputs.artifact-id }}
merge-multiple: true
path: ${{ runner.temp }}/castiron-custom-code

- name: Validate report context
id: context
env:
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.event.workflow_run.id }}
RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
run: |
number=$(jq -er --arg repository "$REPOSITORY" --argjson run "$RUN_ID" \
--argjson attempt "$RUN_ATTEMPT" \
'select(.repository == $repository and .run == $run and .attempt == $attempt) | .pr | select(type == "number" and . > 0 and . == floor)' \
"$RUNNER_TEMP/castiron-custom-code/context.json")
printf 'number=%s\n' "$number" >> "$GITHUB_OUTPUT"

- name: Create or update the single report comment
id: publish
if: needs.compute.result == 'success'
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ steps.context.outputs.number }}
PR_NUMBER: ${{ needs.compute.outputs.number }}
RUN_ID: ${{ github.event.workflow_run.id }}
RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
ARTIFACT_RUN_ID: ${{ github.run_id }}
ARTIFACT_RUN_ATTEMPT: ${{ needs.compute.outputs.artifact-run-attempt }}
run: |
python3 -I scripts/castiron/custom_code_report.py comment \
--report "$RUNNER_TEMP/castiron-custom-code/report.json" \
--repository "$REPOSITORY" --pr "$PR_NUMBER" --run-id "$RUN_ID" \
--run-attempt "$RUN_ATTEMPT"
--run-attempt "$RUN_ATTEMPT" \
--artifact-run-id "$ARTIFACT_RUN_ID" --artifact-run-attempt "$ARTIFACT_RUN_ATTEMPT"

- name: Publish a trusted failure status
if: always() && !cancelled() && steps.publish.outcome != 'success'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/castiron-custom-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: false

env:
REPORTER_SHA256: 73ecd6290e9803b0d0a93af4ca4dccdbf8648cbd5c0cce51ea65fce28c7da79f
REPORTER_SHA256: ac48ca88e9f7ad57195038157e99f055c0cd3dac8de856e4d102dca807766d4a

jobs:
report:
Expand Down
14 changes: 11 additions & 3 deletions api_reference/openapi.transformed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35398,14 +35398,16 @@ components:
- type: string
enum:
- gpt-image-1.5
- gpt-image-2
- gpt-image-2-2026-04-21
- gpt-image-1
- gpt-image-1-mini
- chatgpt-image-latest
- type: 'null'
x-oaiTypeLabel: string
default: gpt-image-1.5
example: gpt-image-1.5
description: The model to use for image editing.
description: The GPT image model to use for image editing, including `gpt-image-2` and its dated snapshot `gpt-image-2-2026-04-21`.
images:
type: array
minItems: 1
Expand Down Expand Up @@ -39136,7 +39138,10 @@ components:
- gpt-image-1.5
- chatgpt-image-latest
description: |
The image generation model to use. Default: `gpt-image-1`.
The image generation model to use. One of `gpt-image-1`,
`gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
`gpt-image-2-2026-04-21`, or `chatgpt-image-latest`. Default:
`gpt-image-1`.
default: gpt-image-1
quality:
type: string
Expand Down Expand Up @@ -68512,7 +68517,10 @@ components:
- gpt-image-1.5
- chatgpt-image-latest
description: |
The image generation model to use. Default: `gpt-image-1`.
The image generation model to use. One of `gpt-image-1`,
`gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
`gpt-image-2-2026-04-21`, or `chatgpt-image-latest`. Default:
`gpt-image-1`.
default: gpt-image-1
quality:
type: string
Expand Down
8 changes: 6 additions & 2 deletions scripts/castiron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ Its hash format is documented in the reporter. Only `.github/actions/` and
`.github/workflows/` are excluded from the content hash.

The read-only pull-request workflow runs on every branch, including drafts and
forks. A separate `workflow_run` publisher reads its report as untrusted data and
uses only code from the trusted default branch to update the PR comment. The
forks. A separate read-only `workflow_run` job computes the authoritative report from
current, GitHub-associated base/head Git objects using the trusted workflow
revision. It fetches those objects into a new bare repository and never checks
out or executes PR code. The comment-writing job consumes only the artifact
from that trusted job, rechecks freshness, and links to its report and patch.
PR-produced reports are advisory run output, not the published assessment. The
publisher becomes active once its workflow is on the default branch. No branch
allowlist or repository variable is needed. Never execute PR-controlled code with
write credentials. Changing either workflow may require one-time AM permission.
Loading
Loading