diff --git a/.github/actions/validate-template/action.yml b/.github/actions/validate-template/action.yml index fb21b2f1..42fb0f0a 100644 --- a/.github/actions/validate-template/action.yml +++ b/.github/actions/validate-template/action.yml @@ -10,14 +10,6 @@ inputs: required: false description: Template directory -outputs: - status: - description: Validate status - value: ${{ fromJSON(steps.validate-template.outputs.result).status }} - detail: - description: Validate detail - value: ${{ fromJSON(steps.validate-template.outputs.result).detail }} - runs: using: composite steps: @@ -32,7 +24,21 @@ runs: INPUT_PATH: ${{ inputs.path }} INPUT_DIRECTORY: ${{ inputs.directory }} ACTION_PATH: ${{ github.action_path }} + shell: bash run: | result=$(deno run --allow-read "${ACTION_PATH}/src/main.ts" "${INPUT_PATH}" "${INPUT_DIRECTORY}") - echo "result=${result}" >> "$GITHUB_OUTPUT" - shell: bash + # Parse JSON and extract status and detail separately + status=$(echo "$result" | jq -r '.status') + detail=$(echo "$result" | jq -r '.detail') + # Print validation result + echo "::group::Validation Result" + echo "Status: ${status}" + echo "Detail:" + echo "$detail" + echo "::endgroup::" + # If status is not 0, fail the action + if [ "$status" != "0" ]; then + echo "::error::Template validation failed" + echo "$detail" + exit 1 + fi diff --git a/.github/workflows/validate-template.yml b/.github/workflows/validate-template.yml index ecee4933..22c47892 100644 --- a/.github/workflows/validate-template.yml +++ b/.github/workflows/validate-template.yml @@ -14,14 +14,6 @@ jobs: - uses: actions/checkout@v2 - name: Validate template - id: validate-template uses: ./.github/actions/validate-template with: - path: $GITHUB_WORKSPACE - - - name: Create comment - if: ${{ steps.validate-template.outputs.status != 0 && !github.event.pull_request.head.repo.fork }} - uses: peter-evans/create-or-update-comment@v1 - with: - issue-number: ${{ github.event.pull_request.number }} - body: ${{ steps.validate-template.outputs.detail }} + path: ${{ github.workspace }}