File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 workflow_dispatch :
55 inputs :
66 pr_number :
7- description : ' Specific PR number to label (leave blank to scan all open PRs )'
7+ description : ' Specific PR number to label (leave blank to scan PRs by state )'
88 required : false
99 type : string
10+ pr_state :
11+ description : ' State of PRs to scan (only used when PR number is blank)'
12+ required : false
13+ type : choice
14+ options :
15+ - open
16+ - closed
17+ - all
18+ default : open
1019 dry_run :
1120 description : ' Dry run (only print proposed labels without applying them)'
1221 required : false
3342 const repo = context.repo.repo;
3443
3544 const prNumberInput = '${{ github.event.inputs.pr_number }}'.trim();
45+ const prStateInput = '${{ github.event.inputs.pr_state }}' || 'open';
3646 const dryRun = ${{ github.event.inputs.dry_run || 'false' }};
3747
3848 // Define the 10 label types, colors, and descriptions
@@ -93,18 +103,18 @@ jobs:
93103 return;
94104 }
95105 } else {
96- console.log(' 🔍 Fetching all open PRs in repository...' );
106+ console.log(` 🔍 Fetching PRs with state "${prStateInput}" in repository...` );
97107 try {
98108 const { data } = await github.rest.pulls.list({
99109 owner,
100110 repo,
101- state: 'open' ,
111+ state: prStateInput ,
102112 per_page: 100
103113 });
104114 prs = data;
105- console.log(` Found ${prs.length} open PR(s) to analyze.`);
115+ console.log(` Found ${prs.length} PR(s) with state "${prStateInput}" to analyze.`);
106116 } catch (err) {
107- core.setFailed(`Failed to fetch open PRs: ${err.message}`);
117+ core.setFailed(`Failed to fetch PRs: ${err.message}`);
108118 return;
109119 }
110120 }
You can’t perform that action at this time.
0 commit comments