@@ -5,7 +5,7 @@ run-name: Deploy PR Review App - PR #${{ github.event.pull_request.number || git
55# Controls when the workflow will run
66on :
77 pull_request :
8- types : [opened, synchronize, reopened]
8+ types : [synchronize, reopened]
99 issue_comment :
1010 types : [created]
1111 workflow_dispatch :
2626 deploy :
2727 if : |
2828 (github.event_name == 'pull_request') ||
29- (github.event_name == 'push') ||
3029 (github.event_name == 'workflow_dispatch') ||
3130 (github.event_name == 'issue_comment' &&
3231 github.event.issue.pull_request &&
@@ -41,34 +40,22 @@ jobs:
4140 env :
4241 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4342 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
7259
7360 if [[ -z "$PR_NUMBER" ]]; then
7461 echo "Error: Could not determine PR number"
@@ -125,6 +112,9 @@ jobs:
125112
126113 # Check if app exists and save state
127114 if ! cpflow exists -a ${{ env.APP_NAME }}; then
115+ if [[ "${{ github.event_name }}" == "pull_request" ]]; then
116+ exit 0
117+ fi
128118 echo "APP_EXISTS=false" >> $GITHUB_ENV
129119 else
130120 echo "APP_EXISTS=true" >> $GITHUB_ENV
0 commit comments