Skip to content

Commit f77a610

Browse files
committed
fixes
1 parent 745ca0e commit f77a610

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

.github/actions/deploy-to-control-plane/action.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,31 @@ inputs:
1010
org:
1111
description: 'The org of the app to deploy'
1212
required: true
13+
github_token:
14+
description: 'The GitHub token for authentication'
15+
required: true
1316

1417
runs:
1518
using: 'composite'
1619
steps:
1720
- name: Setup Environment
1821
uses: ./.github/actions/setup-environment
1922

20-
- name: Set Short SHA
21-
id: vars
23+
- name: Get correct commit SHA
24+
id: get_sha
2225
shell: bash
2326
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 }}
2538

2639
# Updated caching step to v3
2740
- uses: actions/cache@v3
@@ -41,13 +54,13 @@ runs:
4154
4255
# Provision all infrastructure on Control Plane.
4356
# app react-webpack-rails-tutorial will be created per definition in .controlplane/controlplane.yml
44-
- name: cpflow build-image
57+
- name: Build and deploy
4558
shell: bash
4659
run: |
4760
cpln image docker-login
4861
# 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}}
5164
5265
- name: Deploy to Control Plane
5366
shell: bash

.github/workflows/deploy-to-control-plane-review.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ jobs:
139139
with:
140140
app_name: ${{ env.APP_NAME }}
141141
org: ${{ env.CPLN_ORG }}
142+
github_token: ${{ secrets.GITHUB_TOKEN }}
142143

143144
- name: Extract deployment URL
144145
id: extract-url

0 commit comments

Comments
 (0)