@@ -10,18 +10,31 @@ inputs:
10
10
org :
11
11
description : ' The org of the app to deploy'
12
12
required : true
13
+ github_token :
14
+ description : ' The GitHub token for authentication'
15
+ required : true
13
16
14
17
runs :
15
18
using : ' composite'
16
19
steps :
17
20
- name : Setup Environment
18
21
uses : ./.github/actions/setup-environment
19
22
20
- - name : Set Short SHA
21
- id : vars
23
+ - name : Get correct commit SHA
24
+ id : get_sha
22
25
shell : bash
23
26
run : |
24
- echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
27
+ if [[ "$GITHUB_EVENT_NAME" == "issue_comment" ]]; then
28
+ PR_SHA=$(gh pr view ${{ env.PR_NUMBER }} --json headRefOid --jq '.headRefOid')
29
+ echo "sha=$PR_SHA" >> $GITHUB_OUTPUT
30
+ echo "sha_short=${PR_SHA:0:7}" >> $GITHUB_OUTPUT
31
+ else
32
+ echo "sha=$GITHUB_SHA" >> $GITHUB_OUTPUT
33
+ echo "sha_short=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
34
+ fi
35
+ env :
36
+ GITHUB_TOKEN : ${{ inputs.github_token }}
37
+ PR_NUMBER : ${{ env.PR_NUMBER }}
25
38
26
39
# Updated caching step to v3
27
40
- uses : actions/cache@v3
@@ -41,13 +54,13 @@ runs:
41
54
42
55
# Provision all infrastructure on Control Plane.
43
56
# app react-webpack-rails-tutorial will be created per definition in .controlplane/controlplane.yml
44
- - name : cpflow build-image
57
+ - name : Build and deploy
45
58
shell : bash
46
59
run : |
47
60
cpln image docker-login
48
61
# Use BUILDKIT_PROGRESS=plain to get more verbose logging of the build
49
- # BUILDKIT_PROGRESS=plain cpflow build-image -a ${{ inputs.app_name }} --commit ${{steps.vars .outputs.sha_short}} --org ${{inputs.org}}
50
- cpflow build-image -a ${{ inputs.app_name }} --commit=${{steps.vars .outputs.sha_short}} --org=${{inputs.org}}
62
+ # BUILDKIT_PROGRESS=plain cpflow build-image -a ${{ inputs.app_name }} --commit ${{steps.get_sha .outputs.sha_short}} --org ${{inputs.org}}
63
+ cpflow build-image -a ${{ inputs.app_name }} --commit=${{steps.get_sha .outputs.sha_short}} --org=${{inputs.org}}
51
64
52
65
- name : Deploy to Control Plane
53
66
shell : bash
0 commit comments