Skip to content

Commit e5439b2

Browse files
authored
PR #23 from psaux-it/hsntgm-patch-1
Update auto-merge.yml
2 parents 8ce1985 + b554e4d commit e5439b2

File tree

1 file changed

+3
-58
lines changed

1 file changed

+3
-58
lines changed

.github/workflows/auto-merge.yml

+3-58
Original file line numberDiff line numberDiff line change
@@ -34,66 +34,11 @@ jobs:
3434
core.setOutput("shouldMerge", "false");
3535
return;
3636
}
37-
38-
// Retrieve the combined status for the PR's latest commit.
39-
const { data: combinedStatus } = await github.rest.repos.getCombinedStatusForRef({
40-
owner: context.repo.owner,
41-
repo: context.repo.repo,
42-
ref: pr.head.sha
43-
});
44-
core.info(`Combined status state: ${combinedStatus.state}`);
45-
46-
// Only merge if all status checks have passed.
47-
if (combinedStatus.state !== 'success') {
48-
core.info("Not all status checks have passed. Skipping auto-merge.");
49-
core.setOutput("shouldMerge", "false");
50-
return;
51-
}
52-
53-
core.info("All conditions met. PR is eligible for auto-merge.");
54-
core.setOutput("shouldMerge", "true");
55-
result-encoding: string
56-
57-
- name: Wait for checks to pass
58-
if: steps.check.outputs.shouldMerge == 'true'
59-
uses: actions/github-script@v6
60-
with:
61-
script: |
62-
const prNumber = context.payload.pull_request.number;
63-
const { data: pr } = await github.rest.pulls.get({
64-
owner: context.repo.owner,
65-
repo: context.repo.repo,
66-
pull_number: prNumber
67-
});
68-
69-
// Wait for status checks to pass.
70-
let checksPending = true;
71-
let retries = 0;
72-
const maxRetries = 20;
73-
const waitTime = 30000;
74-
75-
while (checksPending && retries < maxRetries) {
76-
const { data: combinedStatus } = await github.rest.repos.getCombinedStatusForRef({
77-
owner: context.repo.owner,
78-
repo: context.repo.repo,
79-
ref: pr.head.sha
80-
});
81-
82-
if (combinedStatus.state === 'success') {
83-
checksPending = false;
84-
} else {
85-
core.info(`Checks still pending. Waiting... (${retries + 1}/${maxRetries})`);
86-
await new Promise(resolve => setTimeout(resolve, waitTime));
87-
retries++;
88-
}
89-
}
9037
91-
if (checksPending) {
92-
throw new Error("Checks did not complete successfully within the time limit.");
93-
}
38+
// Skip combined status check and proceed to auto-merge.
39+
core.info("Skipping status checks. Proceeding with auto-merge.");
40+
core.setOutput("shouldMerge", "true");
9441
95-
core.info("All checks passed.");
96-
9742
- name: Auto-Merge PR
9843
if: steps.check.outputs.shouldMerge == 'true'
9944
uses: actions/github-script@v6

0 commit comments

Comments
 (0)