Skip to content

Commit e0c91c7

Browse files
committed
Justering i input på ciValidate
1 parent b37a451 commit e0c91c7

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.github/actions/ciValidate/action.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ inputs:
77
pools:
88
description: Name of pools to use
99
required: true
10-
baseBranch:
11-
description: The pull request base branch
10+
ref:
11+
description: The head ref of the branch that is proposed to be merged
1212
required: false
13-
default: "main"
1413
deleteScratch:
1514
description: Delete scratch org after validation
1615
required: false
@@ -35,9 +34,13 @@ runs:
3534
- name: validate
3635
shell: bash
3736
run: |
38-
command="sfp validate --pools ${{ inputs.pools }} --targetdevhubusername ${{ inputs.devhub }} --basebranch ${{ inputs.baseBranch }} --coveragepercent ${{ inputs.coveragePercent }} --mode ${{ inputs.mode }} --logsgroupsymbol "::group::,::endgroup::""
37+
command="sfp validate pools --pools ${{ inputs.pools }} --targetdevhubusername ${{ inputs.devhub }} --coveragepercent ${{ inputs.coveragePercent }} --mode ${{ inputs.mode }} --logsgroupsymbol "::group::,::endgroup::""
3938
40-
if [ ${{ inputs.deleteScratch }} ];
39+
if [ "${{ inputs.ref }}" ]; then
40+
command+=" --ref ${{ inputs.ref }}"
41+
fi
42+
43+
if [ "${{ inputs.deleteScratch }}" ];
4144
then
4245
command+=" --deletescratchorg"
4346
fi

.github/workflows/buildAndPublish.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
uses: actions/checkout@v4
102102
with:
103103
fetch-depth: 0
104-
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.ref }}
104+
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.ref_name }}
105105

106106
- name: "Set Git Config"
107107
run: |
@@ -111,7 +111,7 @@ jobs:
111111
112112
- name: Authenticate node
113113
uses: navikt/sf-platform/.github/actions/authenticateNode@main
114-
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' || github.ref_name == 'main' }}
114+
if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main') || github.ref_name }}
115115

116116
- name: Authenticate DevHub
117117
uses: navikt/sf-platform/.github/actions/authenticateOrg@main
@@ -125,6 +125,8 @@ jobs:
125125
with:
126126
devhub: "devhub"
127127
pools: "ciPlatform"
128+
ref: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') && github.event.workflow_run.head_sha || '' }}
129+
baseRef: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') && github.event.workflow_run.pull_requests.base.sha || '' }}
128130

129131
- name: Quick build
130132
uses: navikt/sf-platform/.github/actions/ciQuickBuild@main
@@ -134,18 +136,18 @@ jobs:
134136

135137
- name: Publish artifacts
136138
uses: navikt/sf-platform/.github/actions/publishArtifact@main
137-
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' || github.ref_name == 'main' }}
139+
if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main') || github.ref_name == 'main' }}
138140
with:
139141
nodeToken: ${{ secrets.GITHUB_TOKEN }}
140142

141143
- name: Generate Release Name
142-
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' || github.ref_name == 'main' }}
144+
if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main') || github.ref_name == 'main' }}
143145
id: generate_name
144146
run: |
145147
echo "releaseName=sf-platform_$(date +%s%3N)" >> $GITHUB_OUTPUT
146148
147149
- name: Generate Release Definition
148-
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' || github.ref_name == 'main' }}
150+
if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main') || github.ref_name == 'main' }}
149151
uses: navikt/sf-platform/.github/actions/generateReleaseDefinition@main
150152
with:
151153
branchToCommitTo: ${{ github.ref }}

0 commit comments

Comments
 (0)