@@ -5,7 +5,7 @@ run-name: Deploy PR Review App - PR #${{ github.event.pull_request.number || git
5
5
# Controls when the workflow will run
6
6
on :
7
7
pull_request :
8
- types : [opened, synchronize, reopened]
8
+ types : [synchronize, reopened]
9
9
issue_comment :
10
10
types : [created]
11
11
workflow_dispatch :
26
26
deploy :
27
27
if : |
28
28
(github.event_name == 'pull_request') ||
29
- (github.event_name == 'push') ||
30
29
(github.event_name == 'workflow_dispatch') ||
31
30
(github.event_name == 'issue_comment' &&
32
31
github.event.issue.pull_request &&
@@ -41,34 +40,22 @@ jobs:
41
40
env :
42
41
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43
42
run : |
44
- # For push events, try to find associated PR first
45
- if [[ "${{ github.event_name }}" == "push" ]]; then
46
- PR_DATA=$(gh pr list --head "${{ github.ref_name }}" --json number,headRefName,headRefOid --jq '.[0]')
47
- if [[ -n "$PR_DATA" ]]; then
48
- PR_NUMBER=$(echo "$PR_DATA" | jq -r .number)
49
- else
50
- echo "No PR found for branch ${{ github.ref_name }}, skipping deployment"
51
- echo "DO_DEPLOY=false" >> $GITHUB_ENV
52
- exit 0
53
- fi
54
- else
55
- # Get PR number based on event type
56
- case "${{ github.event_name }}" in
57
- "workflow_dispatch")
58
- PR_NUMBER="${{ github.event.inputs.pr_number }}"
59
- ;;
60
- "issue_comment")
61
- PR_NUMBER="${{ github.event.issue.number }}"
62
- ;;
63
- "pull_request")
64
- PR_NUMBER="${{ github.event.pull_request.number }}"
65
- ;;
66
- *)
67
- echo "Error: Unsupported event type ${{ github.event_name }}"
68
- exit 1
69
- ;;
70
- esac
71
- fi
43
+ # Get PR number based on event type
44
+ case "${{ github.event_name }}" in
45
+ "workflow_dispatch")
46
+ PR_NUMBER="${{ github.event.inputs.pr_number }}"
47
+ ;;
48
+ "issue_comment")
49
+ PR_NUMBER="${{ github.event.issue.number }}"
50
+ ;;
51
+ "pull_request")
52
+ PR_NUMBER="${{ github.event.pull_request.number }}"
53
+ ;;
54
+ *)
55
+ echo "Error: Unsupported event type ${{ github.event_name }}"
56
+ exit 1
57
+ ;;
58
+ esac
72
59
73
60
if [[ -z "$PR_NUMBER" ]]; then
74
61
echo "Error: Could not determine PR number"
@@ -125,6 +112,9 @@ jobs:
125
112
126
113
# Check if app exists and save state
127
114
if ! cpflow exists -a ${{ env.APP_NAME }}; then
115
+ if [[ "${{ github.event_name }}" == "pull_request" ]]; then
116
+ exit 0
117
+ fi
128
118
echo "APP_EXISTS=false" >> $GITHUB_ENV
129
119
else
130
120
echo "APP_EXISTS=true" >> $GITHUB_ENV
0 commit comments