Skip to content

Commit c8500cd

Browse files
committed
big-refactor-might-not-work
1 parent 160c785 commit c8500cd

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

.github/workflows/delete-review-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
}
6161
`);
6262
63-
- name: Initialize and Set Workflow URL
63+
- name: Initialize Workflow
6464
id: init-workflow
6565
uses: actions/github-script@v7
6666
with:

.github/workflows/deploy-to-control-plane.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Deploy Review App to Control Plane
22

3-
run-name: ${{ github.event_name == 'issue_comment' && 'Deploying Review App' || format('Deploying {0} to Staging App', github.ref_name) }}
3+
run-name: ${{ github.event_name == 'issue_comment' && 'Deploying Review App' || format('Updating Review App for {0}', github.ref_name) }}
44

55
on:
66
issue_comment:
@@ -27,8 +27,7 @@ jobs:
2727
(github.event_name == 'issue_comment' &&
2828
github.event.issue.pull_request &&
2929
github.event.comment.body == '/deploy-review-app') ||
30-
(github.event_name == 'push' &&
31-
github.event.pull_request)
30+
github.event_name == 'push'
3231
runs-on: ubuntu-latest
3332
permissions:
3433
contents: read
@@ -55,6 +54,7 @@ jobs:
5554
if [ -n "$PR_NUMBER" ]; then
5655
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
5756
echo "APP_NAME=qa-react-webpack-rails-tutorial-pr-$PR_NUMBER" >> $GITHUB_ENV
57+
echo "has_pr=true" >> $GITHUB_OUTPUT
5858
else
5959
echo "No PR found for this branch"
6060
exit 0
@@ -68,7 +68,7 @@ jobs:
6868
6969
- name: Check if Review App Exists
7070
id: check-app
71-
if: github.event_name == 'push'
71+
if: github.event_name == 'push' && steps.get-pr.outputs.has_pr == 'true'
7272
env:
7373
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
7474
run: |
@@ -80,6 +80,9 @@ jobs:
8080
8181
- name: Get PR HEAD Ref
8282
id: getRef
83+
if: |
84+
github.event_name == 'issue_comment' ||
85+
(steps.get-pr.outputs.has_pr == 'true' && steps.check-app.outputs.app_exists == 'true')
8386
run: |
8487
PR_DATA=$(gh pr view ${{ env.PR_NUMBER }} --repo ${{ github.repository }} --json headRefName,headRefOid)
8588
echo "PR_REF=$(echo "$PR_DATA" | jq -r '.headRefName')" >> $GITHUB_OUTPUT
@@ -88,10 +91,15 @@ jobs:
8891
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8992

9093
- name: Checkout PR Branch
94+
if: |
95+
github.event_name == 'issue_comment' ||
96+
(steps.get-pr.outputs.has_pr == 'true' && steps.check-app.outputs.app_exists == 'true')
9197
run: git checkout ${{ steps.getRef.outputs.PR_REF }}
9298

9399
- name: Deploy to Control Plane
94-
if: github.event_name == 'issue_comment' || steps.check-app.outputs.app_exists == 'true'
100+
if: |
101+
github.event_name == 'issue_comment' ||
102+
(steps.get-pr.outputs.has_pr == 'true' && steps.check-app.outputs.app_exists == 'true')
95103
uses: ./.github/actions/deploy-to-control-plane
96104
with:
97105
app_name: ${{ env.APP_NAME }}

0 commit comments

Comments
 (0)