-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (53 loc) · 1.74 KB
/
Copy pathpr-post-ci.yml
File metadata and controls
58 lines (53 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# SPEC: docs/spec/governance/SPEC-Governance-PR-Post-CI-v1.md
# CI 完成后更新 PR body(CI 表 + Test plan 勾选 + 变更统计);不替代人写 Summary。
name: pr-post-ci
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_run:
workflows:
- pytest
- tech-graph
- tech-graph-contract
- verify-fast
types: [completed]
permissions:
contents: read
pull-requests: write
jobs:
update-pr-body:
runs-on: ubuntu-latest
timeout-minutes: 10
if: >-
github.event_name == 'pull_request' ||
(github.event.workflow_run.conclusion != 'cancelled' &&
github.event.workflow_run.event == 'pull_request')
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Resolve PR number
id: pr
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "number=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
else
sha="${{ github.event.workflow_run.head_sha }}"
num=$(gh pr list --state open --json number,headRefOid \
--jq ".[] | select(.headRefOid==\"$sha\") | .number" | head -1)
if [ -z "$num" ]; then
echo "No open PR for $sha; skip."
echo "number=" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "number=$num" >> "$GITHUB_OUTPUT"
fi
- name: Update PR body
if: steps.pr.outputs.number != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
pip install -q 'requests>=2.28'
python tools/pr_post_ci_update_body.py --pr "${{ steps.pr.outputs.number }}"