From ea556c62f16c72d1cc0e0d1163659f6a0b89f777 Mon Sep 17 00:00:00 2001 From: greg pereira Date: Tue, 12 Nov 2024 08:48:50 -0800 Subject: [PATCH] keep merged prs Signed-off-by: greg pereira --- .github/workflows/release-images.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release-images.yml b/.github/workflows/release-images.yml index 01654767..d50e0a58 100644 --- a/.github/workflows/release-images.yml +++ b/.github/workflows/release-images.yml @@ -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 {