mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 11:31:59 +08:00
1c16ac25d8
* Fix two security issues (#15451) * Fix run_test_cases.yml security issue * Properly fix #15065 * Only run commenting workflows on success. (#15499)
36 lines
1.0 KiB
YAML
36 lines
1.0 KiB
YAML
name: run test cases PR comment
|
|
on:
|
|
workflow_run:
|
|
workflows: ["run test cases"]
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
post-pr-comment:
|
|
if: github.event.workflow_run.conclusion == 'success'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download artifacts
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
RUN_ID: ${{ github.event.workflow_run.id }}
|
|
run: |
|
|
gh run download -R "${{ github.repository }}" --name "pr.txt" "$RUN_ID"
|
|
gh run download -R "${{ github.repository }}" --name "comment.txt" "$RUN_ID"
|
|
- name: Set PR environment variable
|
|
uses: actions/github-script@v4
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const pr = fs.readFileSync('pr.txt', 'utf8').trim();
|
|
core.exportVariable('PR_NUMBER', pr);
|
|
|
|
- name: Update Comment
|
|
uses: peter-evans/create-or-update-comment@v3
|
|
with:
|
|
issue-number: ${{ env.PR_NUMBER }}
|
|
body-path: 'comment.txt' |