Skip to content

Commit

Permalink
server: improve testmerge worker 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Bizzonium committed Oct 6, 2024
1 parent 5d80864 commit 242cf14
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions .github/workflows/testmerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,20 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
sort: 'updated',
direction: 'desc'
});
const labeledPRs = [];
for (const pr of pullRequests) {
console.log(`PR ${pr.title}`);
const labelCheck = pr.labels.some(label => {
console.log(`Label ${label.name}`);
return label.name === label_needed;
});
if (labelCheck) {
const { data: status } = await github.rest.repos.getCombinedStatusForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: pr.head.sha
});
const { data: checkRuns } = await github.rest.checks.listForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: pr.head.sha,
per_page: 100
});
// Check if all checks are passing
const allChecksPassing = checkRuns.check_runs.every(check => {
console.log(`Check ${check.name}: ${check.status}`);
return check.status === 'completed' && check.conclusion === 'success'
});
if (pr.labels.some(label => label.name === label_needed)) {
const { data: prInfo } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number
});
if (allChecksPassing || status.state === 'success' || prInfo.mergeable) {
if (prInfo.mergeable) {
labeledPRs.push({
number: pr.number,
title: pr.title
Expand Down

0 comments on commit 242cf14

Please sign in to comment.