Skip to content

Commit 53aafd1

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

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

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

+34-8
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,25 @@ 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 }}
25-
uses: actions/checkout@v3
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 "event.number: ${{github.event.number}}"
34+
35+
- name: Checkout PR branch - ${{ steps.comment-branch.outputs.head_ref }}
36+
uses: r@v3
2637
with:
27-
ref: ${{ steps.comment-branch.outputs.head_ref }}
38+
ref: ${{ steps.comment-branch.outputs.head_sha }}
2839

2940
- name: Add workflow link as comment on PR
3041
uses: actions/github-script@v6
@@ -33,7 +44,7 @@ jobs:
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,
@@ -49,9 +60,6 @@ jobs:
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

Comments
 (0)