Skip to content

Commit

Permalink
Make validate both standalone and reusable, add inputs and outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
radishmouse committed Jul 12, 2024
1 parent cd642c6 commit 040182f
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,36 @@ name: validate-json

on:
workflow_call:
push:
branches: ["*"]
inputs:
should_download:
description: "Download JSON artifacts if called by another workflow?"
type: boolean
outputs:
is_valid:
description: "Is the JSON valid?"
value: ${{ jobs.validate.outputs.is_valid}}

pull_request:
branches: ["*"]

workflow_dispatch:

jobs:
validate:
runs-on: ubuntu-latest
outputs:
is_valid: ${{ steps.save_state.outputs.is_valid}}

steps:
- uses: actions/checkout@v4

- name: Download JSON artifacts # if called by another workflow
if: ${{ inputs.should_download }}
uses: actions/download-artifact@v4
with:
name: json-files
path: json

- name: Set up Go
uses: actions/setup-go@v5
with:
Expand All @@ -33,5 +50,6 @@ jobs:
fi
- name: Save state
id: save_state
if: steps.validate_json.conclusion == 'success'
run: echo "JV_COMMAND_SUCCESS=true" >> $GITHUB_ENV
run: echo "is_valid=true" >> $GITHUB_OUTPUT

0 comments on commit 040182f

Please sign in to comment.