1
1
name : Deploy to Control Plane
2
2
3
- run-name : ${{ github.event_name == 'issue_comment' && format('Deploying Review App for {0}', github.ref_name) || github.ref == '${{ steps.default-branch.outputs.name }} ' && 'Deploying to Staging' || format('Deploying Review App for {0}', github.ref_name) }}
3
+ run-name : ${{ github.event_name == 'issue_comment' && format('Deploying Review App for {0}', github.ref_name) || github.ref == 'main ' && 'Deploying to Staging' || format('Deploying Review App for {0}', github.ref_name) }}
4
4
5
5
on :
6
6
issue_comment :
15
15
16
16
# Use concurrency to cancel in-progress runs
17
17
concurrency :
18
- group : ${{ github.ref == '${{ steps.default-branch.outputs.name }} ' && 'deploy-staging' || format('deploy-pr-{0}', github.event.issue.number) }}
18
+ group : ${{ github.ref == 'main ' && 'deploy-staging' || format('deploy-pr-{0}', github.event.issue.number) }}
19
19
cancel-in-progress : true
20
20
21
21
jobs :
@@ -36,11 +36,10 @@ jobs:
36
36
issues : write
37
37
env :
38
38
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
39
- CPLN_ORG : ${{ secrets.CPLN_ORG_STAGING }}
40
39
CPLN_TOKEN : ${{ secrets.CPLN_TOKEN_STAGING }}
41
- STAGING_APP_NAME : ${{ secrets.STAGING_APP_NAME }}
42
- REVIEW_APP_PREFIX : ${{ secrets.REVIEW_APP_PREFIX }}
43
- CPLN_APP_NAME : ${{ secrets.CPLN_APP_NAME || github.event.repository.name }}
40
+ CPLN_ORG : ${{ secrets.CPLN_ORG_STAGING }}
41
+ STAGING_APP_NAME : ${{ vars.STAGING_APP_NAME }}
42
+ REVIEW_APP_PREFIX : ${{ vars.REVIEW_APP_PREFIX }}
44
43
45
44
steps :
46
45
- uses : actions/checkout@v4
57
56
58
57
echo "All required environment variables are set"
59
58
59
+ - name : Set Default Branch
60
+ id : default-branch
61
+ run : |
62
+ DEFAULT_BRANCH="main"
63
+ echo "DEFAULT_BRANCH=$DEFAULT_BRANCH" >> $GITHUB_ENV
64
+
60
65
- name : Setup Deployment Configuration
61
66
id : setup
62
67
run : |
87
92
exit 0
88
93
}
89
94
90
- # Get default branch
91
- DEFAULT_BRANCH="refs/heads/$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')"
92
- echo "DEFAULT_BRANCH=$DEFAULT_BRANCH" >> $GITHUB_OUTPUT
93
-
94
95
# Check if we should deploy
95
- if [[ "${{ github.ref }}" == "$DEFAULT_BRANCH" ]]; then
96
+ if [[ "${{ github.ref }}" == "${{ env. DEFAULT_BRANCH }} " ]]; then
96
97
echo "SHOULD_DEPLOY=true" >> $GITHUB_OUTPUT
97
98
echo "IS_STAGING=true" >> $GITHUB_ENV
98
99
echo "APP_NAME=${{ env.STAGING_APP_NAME }}" >> $GITHUB_ENV
0 commit comments