File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ inputs:
1818 hours :
1919 description : ' Pull requests created within this many hours will be listed'
2020 required : false
21- default : ' '
21+ default : ' 24 '
2222outputs :
2323 result :
2424 description : ' Pull requests to be listed'
@@ -46,10 +46,27 @@ runs:
4646 }
4747 );
4848
49- const pr_numbers = resp.data.map(pr => pr.number);
50- core.info(`prs: ${pr_numbers.join(",")}`);
49+ const timeRange = parseInt(${{ inputs.hours }}) * 60 * 60 * 1000;
50+ const sinceTime = new Date(Date.now() - timeRange).toISOString();
51+ const input_labels = ${{ inputs.labels }};
52+ const labels = input_labels
53+ ? input_labels.split(',|\n').map(label => label.trim())
54+ : [];
55+
56+ const prs = resp.data.filter(pr => {
57+ const hasLabel = labels.length === 0
58+ || labels.every(label => pr.labels.some(prLabel => prLabel.name === label));
59+
60+ const createdAt = new Date(pr.created_at);
61+ const isWithinTimeRange = createdAt >= new Date(sinceTime);
62+
63+ return hasLabel && isWithinTimeRange;
64+ });
65+
66+ const pr_urls = prs.map(pr => pr.html_url);
67+ core.info(`prs: ${pr_urls.join(",\n")}`);
5168
52- const prs = resp.data .map(pr => {
69+ return prs.map(pr => {
5370 return {
5471 number: pr.number,
5572 title: pr.title,
You can’t perform that action at this time.
0 commit comments