Skip to content

Commit 45878ad

Browse files
authored
Update fly-review.yml
1 parent c5ea116 commit 45878ad

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/fly-review.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: Deploy Review App
22
on:
33
# Run this workflow on every PR event. Existing review apps will be updated when the PR is updated.
4-
pull_request:
5-
types: [opened, reopened, synchronize, closed]
4+
# pull_request:
5+
# types: [opened, reopened, synchronize, closed]
6+
# Add trigger for comments on PRs
7+
issue_comment:
8+
types: [created, edited]
69

710
env:
811
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
@@ -11,11 +14,18 @@ env:
1114
jobs:
1215
review_app:
1316
runs-on: ubuntu-latest
17+
# Run if commented by me
18+
if: |
19+
github.event_name == 'pull_request' ||
20+
(github.event_name == 'issue_comment' &&
21+
github.event.issue.pull_request &&
22+
contains(github.event.comment.body, '/deploy') &&
23+
github.event.comment.user.login == 'unkn-wn')
1424
outputs:
1525
url: ${{ steps.deploy.outputs.url }}
1626
# Only run one deployment at a time per PR.
1727
concurrency:
18-
group: pr-${{ github.event.number }}
28+
group: pr-${{ github.event.issue.number }}
1929

2030
# Deploying apps with this "review" environment allows the URL for the app to be displayed in the PR UI.
2131
# Feel free to change the name of this environment.
@@ -26,6 +36,9 @@ jobs:
2636
steps:
2737
- name: Get code
2838
uses: actions/checkout@v4
39+
with:
40+
# For comment events, we need to checkout the PR's code
41+
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }}
2942

3043
- name: Deploy PR app to Fly.io
3144
id: deploy

0 commit comments

Comments
 (0)