diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7096e64..fddd927 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,6 +18,7 @@ jobs: contents: read issues: write pull-requests: write + statuses: write steps: - name: React to trigger comment @@ -39,6 +40,20 @@ jobs: SHA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} --jq '.head.sha') echo "sha=$SHA" >> "$GITHUB_OUTPUT" + - name: Set commit status to pending + uses: actions/github-script@v7 + with: + script: | + github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: '${{ steps.sha.outputs.sha }}', + state: 'pending', + target_url: `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`, + description: 'Simulation test running…', + context: 'Simulation Tests', + }); + - uses: actions/checkout@v4 with: ref: ${{ steps.sha.outputs.sha }} @@ -87,6 +102,23 @@ jobs: path: anims/ci_test.mp4 if-no-files-found: warn + - name: Update commit status + uses: actions/github-script@v7 + if: always() + with: + script: | + const success = '${{ steps.verify.outcome }}' === 'success'; + const runUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`; + github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: '${{ steps.sha.outputs.sha }}', + state: success ? 'success' : 'failure', + target_url: runUrl, + description: success ? 'Simulation test passed' : 'Simulation test failed', + context: 'Simulation Tests', + }); + - name: Comment result on PR uses: actions/github-script@v7 if: always()