Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

refactor(ci): share repeated workflow steps with YAML aliases (#1361)

mldangelo-oai081f74d71863
diff --git a/.github/workflows/action-ci.yml b/.github/workflows/action-ci.yml
index 30e8e5eec..27747f3ea 100644
--- a/.github/workflows/action-ci.yml
+++ b/.github/workflows/action-ci.yml
@@ -29,13 +29,16 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - &actions-checkout
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ - &actions-setup-node
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
- - name: Set up the Ubuntu sandbox
+ - &set-up-the-ubuntu-sandbox
+ name: Set up the Ubuntu sandbox
run: |
sudo apt-get update
sudo apt-get install --yes bubblewrap apparmor-profiles
@@ -67,14 +70,8 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- with:
- node-version: "24"
- - name: Set up the Ubuntu sandbox
- run: |
- sudo apt-get update
- sudo apt-get install --yes bubblewrap apparmor-profiles
- sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict
+ - *actions-setup-node
+ - *set-up-the-ubuntu-sandbox
- name: Run the packaged Action without credentials or model calls
id: smoke
uses: ./
@@ -99,12 +96,8 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- with:
- node-version: "24"
+ - *actions-checkout
+ - *actions-setup-node
- name: Check action dependencies
run: npm audit --audit-level=high
- name: Check locked CLI dependencies
diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml
index 1df101256..79376b97b 100644
--- a/.github/workflows/container-release.yml
+++ b/.github/workflows/container-release.yml
@@ -143,7 +143,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- - name: Sign in to GitHub Container Registry
+ - &sign-in-to-github-container-registry
+ name: Sign in to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
@@ -261,12 +262,7 @@ jobs:
pattern: codex-security-image-digest-*
merge-multiple: true
- - name: Sign in to GitHub Container Registry
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
+ - *sign-in-to-github-container-registry
- name: Publish provisional multiarchitecture candidate
id: manifest
@@ -360,12 +356,7 @@ jobs:
packages: write
steps:
- - name: Sign in to GitHub Container Registry
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
+ - *sign-in-to-github-container-registry
- name: Sign verified multiarchitecture candidate provenance
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
@@ -395,12 +386,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- - name: Sign in to GitHub Container Registry
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
+ - *sign-in-to-github-container-registry
- name: Promote the verified, attested, immutable image digest
env:
diff --git a/.github/workflows/invoice-desk-scan.yml b/.github/workflows/invoice-desk-scan.yml
index 29241af44..75da200b1 100644
--- a/.github/workflows/invoice-desk-scan.yml
+++ b/.github/workflows/invoice-desk-scan.yml
@@ -49,7 +49,8 @@ jobs:
with:
ref: ${{ github.sha }}
persist-credentials: false
- - name: Set up Node.js
+ - &set-up-node-js
+ name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
@@ -110,11 +111,7 @@ jobs:
ref: ${{ github.sha }}
path: trusted-workflow
persist-credentials: false
- - name: Set up Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- with:
- node-version: "24"
- package-manager-cache: false
+ - *set-up-node-js
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index 0fbe038d0..491aef324 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -119,13 +119,15 @@ jobs:
with:
fetch-depth: 2
persist-credentials: false
- - name: Set up TypeScript tools
+ - &set-up-typescript-tools
+ name: Set up TypeScript tools
uses: ./.github/actions/setup-tools
with:
cache-dependency-path: |
sdk/typescript/pnpm-lock.yaml
plugins/codex-security/mcp-app/pnpm-lock.yaml
- - name: Install dependencies
+ - &install-dependencies
+ name: Install dependencies
run: |
pnpm --dir sdk/typescript install --frozen-lockfile
pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
@@ -158,7 +160,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- - name: Checkout repository
+ - &checkout-repository
+ name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
@@ -166,16 +169,8 @@ jobs:
run: node sdk/typescript/scripts/check-plugin-source.mjs
- name: Prepare native runtime
uses: ./.github/actions/download-native
- - name: Set up TypeScript tools
- uses: ./.github/actions/setup-tools
- with:
- cache-dependency-path: |
- sdk/typescript/pnpm-lock.yaml
- plugins/codex-security/mcp-app/pnpm-lock.yaml
- - name: Install dependencies
- run: |
- pnpm --dir sdk/typescript install --frozen-lockfile
- pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
+ - *set-up-typescript-tools
+ - *install-dependencies
- name: Audit production dependencies
run: pnpm --dir sdk/typescript run audit:prod
- name: Pack
@@ -204,27 +199,18 @@ jobs:
os: [ubuntu-latest, macos-latest]
shard: [1, 2, 3]
steps:
- - name: Checkout repository
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
+ - *checkout-repository
- name: Prepare native runtime
uses: ./.github/actions/download-native
- - name: Set up TypeScript tools
- uses: ./.github/actions/setup-tools
- with:
- cache-dependency-path: |
- sdk/typescript/pnpm-lock.yaml
- plugins/codex-security/mcp-app/pnpm-lock.yaml
- - name: Set up Bun
+ - *set-up-typescript-tools
+ - &set-up-bun
+ name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
- - name: Install dependencies
- run: |
- pnpm --dir sdk/typescript install --frozen-lockfile
- pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- - name: Download package for this commit
+ - *install-dependencies
+ - &download-package-for-this-commit
+ name: Download package for this commit
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: package-${{ github.sha }}
@@ -272,21 +258,15 @@ jobs:
- os: macos-latest
node: "22.13.0"
steps:
- - name: Checkout repository
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- - name: Set up Node.js
+ - *checkout-repository
+ - &set-up-node-js
+ name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: sdk/typescript/pnpm-lock.yaml
- - name: Download package for this commit
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- with:
- name: package-${{ github.sha }}
- path: dist
+ - *download-package-for-this-commit
- name: Inspect installed package
working-directory: sdk/typescript
run: node scripts/check-package.mjs ../../dist/*.tgz
@@ -297,11 +277,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- - name: Checkout repository
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- - name: Set up TypeScript tools
+ - *checkout-repository
+ - &set-up-mcp-tools
+ name: Set up TypeScript tools
uses: ./.github/actions/setup-tools
with:
cache-dependency-path: plugins/codex-security/mcp-app/pnpm-lock.yaml
@@ -311,11 +289,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install --yes ripgrep
- - name: Download package for this commit
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- with:
- name: package-${{ github.sha }}
- path: dist
+ - *download-package-for-this-commit
- name: Restore bundled plugin
run: tar -xzf dist/*.tgz --strip-components=1 -C sdk/typescript package/_bundled_plugin
- name: Test MCP app
@@ -348,10 +322,7 @@ jobs:
sparse-checkout: |
plugins/codex-security
.github/actions/setup-tools
- - name: Set up TypeScript tools
- uses: ./.github/actions/setup-tools
- with:
- cache-dependency-path: plugins/codex-security/mcp-app/pnpm-lock.yaml
+ - *set-up-mcp-tools
- name: Install plugin dependencies
run: pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- name: Build and test the standalone host runtime
@@ -382,10 +353,7 @@ jobs:
python: "3.12"
markers: cross_platform or native_windows
steps:
- - name: Checkout repository
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
+ - *checkout-repository
- name: Set up Node.js
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -496,11 +464,9 @@ jobs:
matrix:
shard: [1, 2, 3, 4, 5, 6, 7]
steps:
- - name: Checkout repository
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- - name: Set up Python
+ - *checkout-repository
+ - &set-up-python
+ name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
@@ -514,19 +480,9 @@ jobs:
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
package_json_file: package.json
- - name: Set up Bun
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- with:
- bun-version: "1.3.14"
- - name: Install dependencies
- run: |
- pnpm --dir sdk/typescript install --frozen-lockfile
- pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- - name: Download package for this commit
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- with:
- name: package-${{ github.sha }}
- path: dist
+ - *set-up-bun
+ - *install-dependencies
+ - *download-package-for-this-commit
- name: Restore bundled plugin
shell: bash
run: tar -xzf dist/*.tgz --strip-components=1 -C sdk/typescript package/_bundled_plugin
@@ -572,25 +528,10 @@ jobs:
matrix:
node: ["22.13.0", "24"]
steps:
- - name: Checkout repository
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- - name: Set up Python
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
- with:
- python-version: "3.12"
- - name: Set up Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- with:
- node-version: ${{ matrix.node }}
- cache: npm
- cache-dependency-path: sdk/typescript/pnpm-lock.yaml
- - name: Download package for this commit
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- with:
- name: package-${{ github.sha }}
- path: dist
+ - *checkout-repository
+ - *set-up-python
+ - *set-up-node-js
+ - *download-package-for-this-commit
- name: Inspect installed package
working-directory: sdk/typescript
shell: bash
diff --git a/.github/workflows/node-release-pr.yml b/.github/workflows/node-release-pr.yml
index d9c9b1566..a47907213 100644
--- a/.github/workflows/node-release-pr.yml
+++ b/.github/workflows/node-release-pr.yml
@@ -30,14 +30,16 @@ jobs:
RELEASE_PR_DRY_RUN: "true"
steps:
- - name: Checkout main, never the release PR
+ - &checkout-main-never-the-release-pr
+ name: Checkout main, never the release PR
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: main
fetch-depth: 0
persist-credentials: false
- - name: Set up Node.js
+ - &set-up-node-js
+ name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22.13.0"
@@ -61,17 +63,9 @@ jobs:
RELEASE_PR_DRY_RUN: "false"
steps:
- - name: Checkout main, never the release PR
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- ref: main
- fetch-depth: 0
- persist-credentials: false
+ - *checkout-main-never-the-release-pr
- - name: Set up Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- with:
- node-version: "22.13.0"
+ - *set-up-node-js
- name: Create repository-scoped release App token
id: app-token
diff --git a/.github/workflows/test-quality.yml b/.github/workflows/test-quality.yml
index ea3fe834b..a6429b98c 100644
--- a/.github/workflows/test-quality.yml
+++ b/.github/workflows/test-quality.yml
@@ -93,7 +93,8 @@ jobs:
mode: shard-7
args: --shard=7/7
steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - &actions-checkout
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
@@ -103,7 +104,8 @@ jobs:
python-version: "3.12"
- name: Prepare native runtime
uses: ./.github/actions/download-native
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ - &actions-setup-node
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22.13.0"
- name: Set up pnpm
@@ -150,13 +152,10 @@ jobs:
needs: [runner]
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- with:
- node-version: "22.13.0"
- - uses: ./.github/actions/setup-tools
+ - *actions-checkout
+ - *actions-setup-node
+ - &github-actions-setup-tools
+ uses: ./.github/actions/setup-tools
with:
setup-node: false
- name: Install dependencies
@@ -183,16 +182,12 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
+ - *actions-checkout
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
# Stryker 10's Babel 8 requires Node 22.18+ or 24.11+.
node-version: "24.15.0"
- - uses: ./.github/actions/setup-tools
- with:
- setup-node: false
+ - *github-actions-setup-tools
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"