Skip to content

Commit c393ad1

Browse files
fi3eworkampcode-com
andcommitted
feat: support explicit pr-number input in ecosystem_ci_dispatch
When pr-number is provided, use it directly via pulls.get() instead of searching PRs by branch name. This avoids pagination limits, fork PR ambiguity, and duplicate branch name issues. The branch-based lookup is kept as a fallback for callers that do not know the PR number. Amp-Thread-ID: https://ampcode.com/threads/T-019d3d10-71af-716a-a2ee-e4a3df4d5b7a Co-authored-by: Amp <amp@ampcode.com>
1 parent ca00670 commit c393ad1

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/actions/ecosystem_ci_dispatch/action.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ inputs:
2323
description: "Job name prefix to match when summarizing downstream jobs"
2424
required: false
2525
default: "execute-all "
26+
pr-number:
27+
description: "Explicit PR number to comment on. When set, skips branch-based PR lookup."
28+
required: false
29+
default: ""
2630
branch:
27-
description: "Branch name to match against open pull requests when locating the PR number"
31+
description: "Branch name to match against open pull requests when locating the PR number. Used only when pr-number is not set."
2832
required: false
2933
default: ""
3034

@@ -56,6 +60,22 @@ runs:
5660
name: Get PR Number
5761
with:
5862
script: |
63+
const explicitPr = '${{ inputs.pr-number }}';
64+
if (explicitPr) {
65+
const num = Number(explicitPr);
66+
const { data: pr } = await github.rest.pulls.get({
67+
owner: '${{ inputs.ecosystem-owner }}',
68+
repo: '${{ inputs.ecosystem-repo }}',
69+
pull_number: num,
70+
});
71+
console.log(`Using explicit PR #${num}: ${pr.html_url}`);
72+
return {
73+
num,
74+
branchName: pr.head.ref,
75+
repo: pr.head.repo.full_name
76+
};
77+
}
78+
5979
const { data: prs } = await github.rest.pulls.list({
6080
owner: '${{ inputs.ecosystem-owner }}',
6181
repo: '${{ inputs.ecosystem-repo }}',

0 commit comments

Comments
 (0)