Skip to content

Commit 98a2427

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

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

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

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
- name: Cancel previous runs
1818
uses: styfle/cancel-workflow-action@0.9.1
1919

20-
- name: Get branch of PR
21-
uses: xt0rted/pull-request-comment-branch@v1
22-
id: comment-branch
23-
24-
- name: Checkout PR branch ${{ steps.comment-branch.outputs.head_ref }}
25-
uses: actions/checkout@v3
26-
with:
27-
ref: ${{ steps.comment-branch.outputs.head_ref }}
20+
- name: Checkout Pull Request - ${{ github.event.pull_request.title }}
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
PR_URL="${{ github.event.issue.pull_request.url }}"
25+
PR_NUM=${PR_URL##*/}
26+
echo "Checking out from PR #$PR_NUM based on URL: $PR_URL"
27+
gh pr checkout $PR_NUM
2828
2929
- name: Add workflow link as comment on PR
3030
uses: actions/github-script@v6
@@ -33,7 +33,7 @@ jobs:
3333
script: |
3434
const name = '${{ github.workflow }}';
3535
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
36-
const body = `Run GH Workflow: ${name}`;
36+
const body = `Run GH Workflow: ${name}\n${url}`;
3737
3838
await github.rest.issues.createComment({
3939
issue_number: context.issue.number,
@@ -49,9 +49,6 @@ jobs:
4949

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

5653
- name: Install Apple certificate and provisioning profile
5754
env:
@@ -130,3 +127,21 @@ jobs:
130127
- name: 4/4 - Build example (paper, dynamic frameworks)
131128
run: yarn run build:ios
132129

130+
# Builds completed...
131+
132+
- name: Add workflow result as comment on PR
133+
uses: actions/github-script@v6
134+
if: always()
135+
with:
136+
script: |
137+
const name = '${{ github.workflow }}';
138+
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
139+
const success = '${{ job.status }}' === 'success';
140+
const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
141+
142+
await github.rest.issues.createComment({
143+
issue_number: context.issue.number,
144+
owner: context.repo.owner,
145+
repo: context.repo.repo,
146+
body: body
147+
})

0 commit comments

Comments
 (0)