Skip to content

Commit 191bab6

Browse files
committed
⚙️ Chore: Update build-example-ios-for-pr Workflow
1 parent 00784af commit 191bab6

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

.github/workflows/build-example-ios-for-pr.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,21 @@ 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+
34+
- name: Checkout PR branch - ${{ steps.comment-branch.outputs.head_ref }}
2535
uses: actions/checkout@v3
2636
with:
2737
ref: ${{ steps.comment-branch.outputs.head_ref }}
@@ -33,7 +43,7 @@ jobs:
3343
script: |
3444
const name = '${{ github.workflow }}';
3545
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
36-
const body = `Run GH Workflow: ${name}`;
46+
const body = `Run GH Workflow: ${name}\n${url}`;
3747
3848
await github.rest.issues.createComment({
3949
issue_number: context.issue.number,
@@ -49,9 +59,6 @@ jobs:
4959

5060
- name: Check Xcode version
5161
run: /usr/bin/xcodebuild -version
52-
53-
- name: Checkout repo from main branch
54-
uses: actions/checkout@v4
5562

5663
- name: Install Apple certificate and provisioning profile
5764
env:
@@ -130,3 +137,21 @@ jobs:
130137
- name: 4/4 - Build example (paper, dynamic frameworks)
131138
run: yarn run build:ios
132139

140+
# Builds completed...
141+
142+
- name: Add workflow result as comment on PR
143+
uses: actions/github-script@v6
144+
if: always()
145+
with:
146+
script: |
147+
const name = '${{ github.workflow }}';
148+
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
149+
const success = '${{ job.status }}' === 'success';
150+
const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
151+
152+
await github.rest.issues.createComment({
153+
issue_number: context.issue.number,
154+
owner: context.repo.owner,
155+
repo: context.repo.repo,
156+
body: body
157+
})

0 commit comments

Comments
 (0)