Skip to content

Commit 2ac4f0a

Browse files
committed
fix(helm/release-chart): update dependencies only if exist
Signed-off-by: Emilien Escalle <[email protected]>
1 parent 28f0ad1 commit 2ac4f0a

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
"esbenp.prettier-vscode",
2121
"ms-azuretools.vscode-containers",
2222
"Tim-Koehler.helm-intellisense"
23-
]
23+
],
24+
"settings": {
25+
"terminal.integrated.defaultProfile.linux": "zsh"
26+
}
2427
}
2528
}
2629
}

.github/workflows/__greetings.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Greetings
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request_target:
7+
branches: [main]
8+
9+
permissions: {}
10+
11+
jobs:
12+
greetings:
13+
uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@5ac504609f6ef35c5ac94bd8199063aa32104721 # 0.31.3
14+
permissions:
15+
contents: read
16+
issues: write
17+
pull-requests: write

actions/helm/release-chart/action.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,39 +80,44 @@ runs:
8080

8181
- id: chart-values-updates
8282
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
83+
env:
84+
INPUT_PATH: ${{ inputs.path }}
85+
INPUT_TAG: ${{ inputs.tag }}
86+
INPUT_UPDATE_TAG_PATHS: ${{ inputs.update-tag-paths }}
87+
REPOSITORY_NAME: ${{ github.event.repository.name }}
8388
with:
8489
script: |
8590
const path = require('node:path');
8691
8792
const yqUpdates = {};
88-
const basePath = `${{ inputs.path }}`;
93+
const basePath = process.env.INPUT_PATH;
8994
if (!basePath) {
9095
throw new Error(`"path" input is missing`);
9196
}
9297
93-
const tag = `${{ inputs.tag }}`;
98+
const tag = process.env.INPUT_TAG;
9499
if (!tag) {
95100
throw new Error(`"tag" input is missing`);
96101
}
97102
98-
const updateTagPaths = `${{ inputs.update-tag-paths }}`.trim().split(',').map(p => p.trim()).filter(p => p);
103+
const updateTagPaths = process.env.INPUT_UPDATE_TAG_PATHS.trim().split(',').map(p => p.trim()).filter(p => p);
99104
100105
// Chart.yml files
101106
const globber = await glob.create(`${basePath}/**/Chart.yaml`, {followSymbolicLinks: false})
102107
for await (const chartFile of globber.globGenerator()) {
103-
const filePath = path.relative(`${{ github.workspace }}`, chartFile);
108+
const filePath = path.relative(process.env.GITHUB_WORKSPACE, chartFile);
104109
if (!yqUpdates[filePath]) {
105110
yqUpdates[filePath] = [];
106111
}
107112
108-
const isRootChart = filePath === `${basePath}/Chart.yaml`;
113+
const isRootChart = filePath === path.join(basePath, "Chart.yaml");
109114
if (isRootChart) {
110115
// Update name for root chart
111-
yqUpdates[filePath].push(`.name = "${{ github.event.repository.name }}"`);
116+
yqUpdates[filePath].push(`.name = "${process.env.REPOSITORY_NAME}"`);
112117
113118
// Update dependencies version where repository starts with file://
114-
if(updateTagPaths.includes('.version')) {
115-
yqUpdates[filePath].push(`(.dependencies[] | select(.repository == "file://*")).version = "${tag}"`);
119+
if (updateTagPaths.includes('.version')) {
120+
yqUpdates[filePath].push(`(.dependencies[]? | select(.repository == "file://*")).version = "${tag}"`);
116121
}
117122
}
118123

0 commit comments

Comments
 (0)