File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 5454 core.setOutput("shouldMerge", "true");
5555 result-encoding : string
5656
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+ }
90+
91+ if (checksPending) {
92+ throw new Error("Checks did not complete successfully within the time limit.");
93+ }
94+
95+ core.info("All checks passed.");
96+
5797 - name : Auto-Merge PR
5898 if : steps.check.outputs.shouldMerge == 'true'
5999 uses : actions/github-script@v6
You can’t perform that action at this time.
0 commit comments