Skip to content

Bump codecov/codecov-action from 3 to 4 #25

Bump codecov/codecov-action from 3 to 4

Bump codecov/codecov-action from 3 to 4 #25

name: Generate JSON Schema
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
NODE_VERSION: 20.x
TYPESCRIPT_JSON_SCHEMA_VERSION: "^0.62.0" # 0.62.0 or higher but less than 1
PYTHON_VERSION: "3.10"
# Add Globals for Github actions bot
GITHUB_ACTIONS_USERNAME: "github-actions[bot]"
GITHUB_ACTIONS_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
YQ_BINARY_URL: "https://github.com/mikefarah/yq/releases/download/v4.41.1/yq_linux_amd64"
jobs:
generate_json_schema:
runs-on: ubuntu-latest
steps:
# From https://github.com/EndBug/add-and-commit?tab=readme-ov-file#working-with-prs
- if: github.event_name != 'pull_request'
uses: actions/checkout@v4
- if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install TypeScript JSON Schema
run: npm install typescript-json-schema@${{ env.TYPESCRIPT_JSON_SCHEMA_VERSION }}
- name: Install JSON Schema
run: |
pip install \
jsonschema \
ruamel.yaml
- name: Install yq
run: |
wget \
--output-document yq \
"${{ env.YQ_BINARY_URL }}"
chmod +x yq
sudo mv yq /usr/local/bin/yq
- name: Run TypeScript JSON Schema on Workflow object
run: |
npx typescript-json-schema \
--required --noExtraProps \
tsconfig.json \
Workflow > cwl_schema.raw.json
- name: Curate JSON Schema
run: |
mkdir -p json_schemas
python3 \
.github/scripts/curate_autogenerated_schema.py \
cwl_schema.raw.json \
json_schemas/cwl_schema.json
- name: Validate JSON Schema
run: |
python3 \
.github/scripts/validate_schema.py \
json_schemas/cwl_schema.json
- name: Convert cwl schema json to yq
run: |
yq \
--output-format=yaml \
--prettyPrint \
--unwrapScalar < json_schemas/cwl_schema.json \
> json_schemas/cwl_schema.yaml
- name: Commit JSON Schema
uses: EndBug/add-and-commit@v9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
add: "['json_schemas/cwl_schema.json', 'json_schemas/cwl_schema.yaml']"
message: "Updating CWL and CWLGraph Schema"
default_author: github_actions
push: true