@@ -17,11 +17,22 @@ jobs:
1717 - name : Cancel previous runs
1818 uses : styfle/cancel-workflow-action@0.9.1
1919
20+ - name : Checkout repo from main branch
21+ uses : actions/checkout@v4
22+
2023 - name : Get branch of PR
21- uses : xt0rted/pull-request-comment-branch@v1
24+ uses : xt0rted/pull-request-comment-branch@v3
2225 id : comment-branch
2326
24- - name : Checkout PR branch ${{ steps.comment-branch.outputs.head_ref }}
27+ - name : Debug
28+ run : |
29+ echo "base_ref: ${{steps.comment-branch.outputs.base_ref}}"
30+ echo "base_sha: ${{steps.comment-branch.outputs.base_sha}}"
31+ echo "head_ref: ${{steps.comment-branch.outputs.head_ref}}"
32+ echo "head_sha: ${{steps.comment-branch.outputs.head_sha}}"
33+ echo "head_sha: ${{github.event.number}}"
34+
35+ - name : Checkout PR branch - ${{ steps.comment-branch.outputs.head_ref }}
2536 uses : actions/checkout@v3
2637 with :
2738 ref : ${{ steps.comment-branch.outputs.head_ref }}
3344 script : |
3445 const name = '${{ github.workflow }}';
3546 const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
36- const body = `Run GH Workflow: ${name}`;
47+ const body = `Run GH Workflow: ${name}\n${url} `;
3748
3849 await github.rest.issues.createComment({
3950 issue_number: context.issue.number,
4960
5061 - name : Check Xcode version
5162 run : /usr/bin/xcodebuild -version
52-
53- - name : Checkout repo from main branch
54- uses : actions/checkout@v4
5563
5664 - name : Install Apple certificate and provisioning profile
5765 env :
@@ -130,3 +138,21 @@ jobs:
130138 - name : 4/4 - Build example (paper, dynamic frameworks)
131139 run : yarn run build:ios
132140
141+ # Builds completed...
142+
143+ - name : Add workflow result as comment on PR
144+ uses : actions/github-script@v6
145+ if : always()
146+ with :
147+ script : |
148+ const name = '${{ github.workflow }}';
149+ const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
150+ const success = '${{ job.status }}' === 'success';
151+ const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
152+
153+ await github.rest.issues.createComment({
154+ issue_number: context.issue.number,
155+ owner: context.repo.owner,
156+ repo: context.repo.repo,
157+ body: body
158+ })
0 commit comments