Skip to content

Commit

Permalink
fix(ci): limit api rate usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kduret committed Dec 5, 2024
1 parent 3227104 commit adf172c
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions .github/actions/package-delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,22 @@ runs:
const warningNoPromote = 'No packages are promoted because push is not related to a hotfix/release pull request.';
const commitSha = context.sha;
const { data: { items } } = await github.rest.search.issuesAndPullRequests({
q: `${commitSha} type:pr is:merged`
const pulls = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
sort: 'updated',
direction: 'desc',
state: 'closed',
per_page: 100
});
if (items.length === 0) {
const pr = pulls.data.find(p => p.merge_commit_sha === commitSha);
if (!pr) {
core.warning(warningNoPromote);
return;
}
const prNumber = items[0].number;
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
const prBaseRef = pr.data?.base?.ref || 'unknown';
const prBaseRef = pr?.base?.ref || 'unknown';
let releaseType = '';
switch (true) {
case /^release.+/.test(prBaseRef):
Expand Down

0 comments on commit adf172c

Please sign in to comment.