mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
fix(ci): dispatch metrics branch validation (#1878)
* fix(ci): dispatch metrics branch validation * fix(ci): dispatch metrics branch validation Generated-By: looper 0.0.0-dev (runner=fixer, agent=opencode) * fix(ci): dispatch metrics branch validation Generated-By: looper 0.0.0-dev (runner=fixer, agent=opencode) * fix(ci): dispatch metrics branch validation Generated-By: looper 0.0.0-dev (runner=fixer, agent=opencode) * fix(ci): dispatch metrics branch validation Generated-By: looper 0.0.0-dev (runner=fixer, agent=opencode) * fix(ci): dispatch metrics branch validation Generated-By: looper 0.0.0-dev (runner=fixer, agent=opencode) * fix(ci): dispatch metrics branch validation Generated-By: looper 0.0.0-dev (runner=fixer, agent=opencode)
This commit is contained in:
parent
ff6f673f05
commit
fd82384b5e
1 changed files with 32 additions and 0 deletions
32
.github/workflows/metrics.yml
vendored
32
.github/workflows/metrics.yml
vendored
|
|
@ -12,6 +12,7 @@ on:
|
|||
- .github/workflows/metrics.yml
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
|
|
@ -68,3 +69,34 @@ jobs:
|
|||
|
||||
config_timezone: Asia/Shanghai
|
||||
config_display: large
|
||||
|
||||
- name: Trigger CI for metrics PR branch
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
METRICS_PR_TITLE: 'Auto-generated metrics for run #${{ github.run_id }}'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
METRICS_BRANCH="metrics-run-${{ github.run_id }}"
|
||||
|
||||
if ! gh api "repos/${{ github.repository }}/branches/$METRICS_BRANCH" >/dev/null 2>&1; then
|
||||
echo "No metrics branch created for run ${{ github.run_id }}; skipping CI dispatch"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
METRICS_PR_VIEW="$(gh pr list \
|
||||
--repo "${{ github.repository }}" \
|
||||
--state open \
|
||||
--head "$METRICS_BRANCH" \
|
||||
--base main \
|
||||
--limit 1 \
|
||||
--json number,title,baseRefName,headRefName \
|
||||
--jq 'if length == 0 then "" else .[0] | [.number, .title, .baseRefName, .headRefName] | @tsv end')"
|
||||
|
||||
IFS=$'\t' read -r METRICS_PR_NUMBER METRICS_PR_FOUND_TITLE METRICS_PR_BASE METRICS_PR_BRANCH <<< "$METRICS_PR_VIEW"
|
||||
|
||||
if [ -z "$METRICS_PR_NUMBER" ] || [ "$METRICS_PR_FOUND_TITLE" != "$METRICS_PR_TITLE" ] || [ "$METRICS_PR_BASE" != 'main' ] || [ "$METRICS_PR_BRANCH" != "$METRICS_BRANCH" ]; then
|
||||
echo "Expected an open metrics PR for branch '$METRICS_BRANCH' targeting main" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gh workflow run ci.yml --repo "${{ github.repository }}" --ref "$METRICS_BRANCH"
|
||||
|
|
|
|||
Loading…
Reference in a new issue