Skip to content

Commit 7179505

Browse files
committed
ci: request TechEngine PR validation comments
1 parent a66096d commit 7179505

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: request-engine-pr-validation
2+
3+
# Ask TechEngine to validate data PRs and report the result back as a PR
4+
# comment. The ordinary PR check still runs locally; this gives curator-facing
5+
# feedback from the engine repository without moving PR ownership away from the
6+
# human author.
7+
on:
8+
pull_request:
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
paths:
11+
- "data/**"
12+
- "site/public/v1/**"
13+
- "site/public/openapi.json"
14+
- "app/validate.py"
15+
workflow_dispatch:
16+
inputs:
17+
pr_number:
18+
description: "TechAPI PR number to validate"
19+
type: string
20+
required: true
21+
head_sha:
22+
description: "TechAPI commit SHA to validate"
23+
type: string
24+
required: true
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
request:
31+
runs-on: ubuntu-latest
32+
env:
33+
ENGINE_TOKEN: ${{ secrets.ENGINE_TOKEN }}
34+
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
35+
HEAD_SHA: ${{ github.event.pull_request.head.sha || inputs.head_sha }}
36+
HEAD_REF: ${{ github.event.pull_request.head.ref || '' }}
37+
PR_URL: ${{ github.event.pull_request.html_url || '' }}
38+
steps:
39+
- name: Skip when ENGINE_TOKEN is unset
40+
if: env.ENGINE_TOKEN == ''
41+
run: echo "::warning::ENGINE_TOKEN not configured; TechEngine PR validation comment was not requested."
42+
43+
- name: Dispatch TechEngine PR validation
44+
if: env.ENGINE_TOKEN != ''
45+
uses: actions/github-script@v7
46+
with:
47+
github-token: ${{ secrets.ENGINE_TOKEN }}
48+
script: |
49+
await github.rest.repos.createDispatchEvent({
50+
owner: 'GetTechAPI',
51+
repo: 'TechEngine',
52+
event_type: 'techapi-pr-validate',
53+
client_payload: {
54+
pr_number: process.env.PR_NUMBER,
55+
head_sha: process.env.HEAD_SHA,
56+
head_ref: process.env.HEAD_REF,
57+
pr_url: process.env.PR_URL,
58+
requested_by: context.actor
59+
}
60+
})

0 commit comments

Comments
 (0)