mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
ci: simplify PR lookup using gh pr view
This commit is contained in:
48
.github/workflows/ci-tests-e2e.yaml
vendored
48
.github/workflows/ci-tests-e2e.yaml
vendored
@@ -194,42 +194,24 @@ jobs:
|
|||||||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) ||
|
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) ||
|
||||||
(github.event_name == 'workflow_run')
|
(github.event_name == 'workflow_run')
|
||||||
outputs:
|
outputs:
|
||||||
pr_number: ${{ steps.get-pr.outputs.result }}
|
pr_number: ${{ steps.get-pr.outputs.number }}
|
||||||
branch: ${{ steps.get-branch.outputs.branch }}
|
branch: ${{ steps.get-pr.outputs.branch }}
|
||||||
steps:
|
steps:
|
||||||
- name: Get PR number
|
- name: Get PR number
|
||||||
id: get-pr
|
id: get-pr
|
||||||
uses: actions/github-script@v7
|
env:
|
||||||
with:
|
GH_TOKEN: ${{ github.token }}
|
||||||
script: |
|
PR_TARGET_REPO: ${{ github.repository }}
|
||||||
if (context.eventName === 'pull_request') {
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
return context.payload.pull_request.number;
|
PR_BRANCH: ${{ github.head_ref || github.event.workflow_run.head_branch }}
|
||||||
}
|
run: |
|
||||||
|
echo "branch=${PR_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
// First check pull_requests from payload (most reliable)
|
if [ -n "$PR_NUMBER" ]; then
|
||||||
const prs = context.payload.workflow_run.pull_requests;
|
echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT
|
||||||
if (prs && prs.length > 0) {
|
else
|
||||||
return prs[0].number;
|
gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" \
|
||||||
}
|
--json 'number' --jq '"number=\(.number)"' >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
// Fallback: branch-based lookup with pagination
|
|
||||||
const head = `${context.repo.owner}:${context.payload.workflow_run.head_branch}`;
|
|
||||||
|
|
||||||
for await (const response of github.paginate.iterator(
|
|
||||||
github.rest.pulls.list,
|
|
||||||
{ owner: context.repo.owner, repo: context.repo.repo, state: 'open', head, per_page: 100 }
|
|
||||||
)) {
|
|
||||||
if (response.data.length > 0) {
|
|
||||||
return response.data[0].number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('No PR found');
|
|
||||||
return '';
|
|
||||||
|
|
||||||
- name: Get branch name
|
|
||||||
id: get-branch
|
|
||||||
run: echo "branch=${{ github.head_ref || github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# Post starting comment for non-forked PRs
|
# Post starting comment for non-forked PRs
|
||||||
comment-on-pr-start:
|
comment-on-pr-start:
|
||||||
|
|||||||
Reference in New Issue
Block a user