File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 23
23
name : Trigger Private CI
24
24
runs-on : ubuntu-latest
25
25
steps :
26
+ # Find a merge commit. We cannot use merge_commit_sha from context directly because
27
+ # mergeability check is asynchronous to pull_request_target trigger..
28
+ - name : Find the merge commit
29
+ id : merge
30
+ if : github.event_name == 'pull_request_target'
31
+ uses : actions/github-script@v7
32
+ with :
33
+ script : |
34
+ for (let i = 0; i <= 5; i++) {
35
+ const { data: pr } = await github.rest.pulls.get({
36
+ owner: context.repo.owner,
37
+ repo: context.repo.repo,
38
+ pull_number: context.issue.number,
39
+ });
40
+
41
+ if (i != 5 && pr.mergeable == null) {
42
+ console.log("Mergeability check in progress");
43
+ await new Promise(r => setTimeout(r, 2000));
44
+ continue;
45
+ }
46
+
47
+ if (pr.mergeable) {
48
+ core.setOutput('merge_sha', pr.merge_commit_sha);
49
+ } else {
50
+ core.setFailed('Pull request is not mergeable');
51
+ }
52
+ break;
53
+ }
54
+
26
55
# Create pending statuses to block merge group and give indication before jobs are picked up.
27
56
- name : Create pending statuses
28
57
run : |
40
69
run : |
41
70
gh workflow run ibex-private-ci.yml --repo lowRISC/lowrisc-private-ci \
42
71
-f ref="${{ github.event.pull_request.head.sha || github.sha }}" \
43
- -f sha="${{ github.event.pull_request.merge_commit_sha || github.sha }}"
72
+ -f sha="${{ steps.merge.outputs.merge_sha || github.sha }}"
44
73
env :
45
74
GITHUB_TOKEN : ${{ secrets.LOWRISC_PRIVATE_CI_PAT }}
You can’t perform that action at this time.
0 commit comments