Skip to content

Commit

Permalink
keep merged prs
Browse files Browse the repository at this point in the history
Signed-off-by: greg pereira <[email protected]>
  • Loading branch information
Gregory-Pereira committed Nov 12, 2024
1 parent e448969 commit ea556c6
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/release-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,16 @@ jobs:
script: |
console.log("Repository owner:", context.repo.owner);
console.log("Repository name:", context.repo.repo);
console.log("Current commit SHA:", context.sha);
const commits = await github.rest.repos.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
per_page: 1
});
const commitSha = commits.data[0].sha;
console.log("Fetched commit SHA:", commitSha);
const prs = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed',
merged: 'true',
sort: 'updated',
direction: 'desc'
});
console.log("Number of closed PRs fetched:", prs.data.length);
console.log("Most recent PR:", prs.data[0]);
const pr = prs.data.find(pr => pr.merge_commit_sha === commitSha);
if (pr) {
if (prs.length > 0) {
console.log("Matching PR found:", pr.number);
return pr.number;
} else {
Expand Down

0 comments on commit ea556c6

Please sign in to comment.