Comment on model.json validation #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Comment on model.json validation | |
| on: | |
| workflow_run: | |
| workflows: [Validate model.json] | |
| types: | |
| - completed | |
| permissions: | |
| actions: read | |
| contents: read | |
| issues: write | |
| jobs: | |
| comment: | |
| name: Comment on model.json validation | |
| if: github.event.workflow_run.pull_requests[0].number != null | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download validation result | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: model-json-validation | |
| path: artifacts | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| - name: Checkout comment action | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| with: | |
| persist-credentials: false | |
| - name: Read validation result | |
| id: validation-result | |
| run: | | |
| echo "status=$(cat artifacts/model_json_validation_status.txt)" >> "$GITHUB_OUTPUT" | |
| - name: Create or update validation comment | |
| if: steps.validation-result.outputs.status != 'success' | |
| uses: ./.github/actions/upsert-pr-comment | |
| with: | |
| pr-number: ${{ github.event.workflow_run.pull_requests[0].number }} | |
| body-file: artifacts/model_json_validation_report.md | |
| match-text: | | |
| <!-- model.json validate action comment --> | |
| **JSON Schema validation failed | |
| - name: Clear validation comment | |
| if: steps.validation-result.outputs.status == 'success' | |
| uses: ./.github/actions/upsert-pr-comment | |
| with: | |
| pr-number: ${{ github.event.workflow_run.pull_requests[0].number }} | |
| state: absent | |
| match-text: | | |
| <!-- model.json validate action comment --> | |
| **JSON Schema validation failed |