Skip to content

Commit deb4c04

Browse files
authored
Merge branch 'main' into default-version
2 parents 6f617a7 + 0d09729 commit deb4c04

File tree

8 files changed

+2183
-5000
lines changed

8 files changed

+2183
-5000
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @Azure/aks-atlanta
1+
* @Azure/cloud-native-github-action-owners

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ jobs:
7676
--repo helm/helm \
7777
--exclude-drafts \
7878
--exclude-pre-releases \
79-
--limit 1 | awk '{print $4}')
79+
--json name,isLatest \
80+
--jq '.[] | select(.isLatest)|.name' | awk '{print $2}')
8081
8182
if [[ $(helm version) != *$HELM_LATEST* ]]; then
8283
echo "HELM VERSION INCORRECT: HELM VERSION DOES NOT CONTAIN $HELM_LATEST"

.github/workflows/release-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
permissions:
1414
actions: read
1515
contents: write
16-
uses: Azure/action-release-workflows/.github/workflows/release_js_project.yaml@1b199cc979febcb43526d33853f2d71183091cdb # v1.0.2
16+
uses: Azure/action-release-workflows/.github/workflows/release_js_project.yaml@3c677ba5ab58f5c5c1a6f0cfb176b333b1f27405 # v1.0.3
1717
with:
1818
changelogPath: ./CHANGELOG.md

.husky/pre-commit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
npm test
2+
npm run format-check || {
3+
echo ""
4+
echo "❌ Formatting check failed."
5+
echo "💡 Run 'npm run format' or 'prettier --write .' to fix formatting issues."
6+
exit 1
7+
}

package-lock.json

Lines changed: 2148 additions & 4987 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,21 @@
1515
},
1616
"main": "lib/index.js",
1717
"scripts": {
18-
"prebuild": "npm i ncc",
1918
"build": "ncc build src/index.ts -o lib",
2019
"test": "jest",
2120
"test-coverage": "jest --coverage",
2221
"format": "prettier --write .",
23-
"format-check": "prettier --check ."
22+
"format-check": "prettier --check .",
23+
"prepare": "husky"
2424
},
2525
"devDependencies": {
2626
"@types/jest": "^30.0.0",
27-
"@types/node": "^24.0.1",
27+
"@types/node": "^24.1.0",
2828
"@vercel/ncc": "^0.38.3",
29-
"jest": "^30.0.0",
30-
"prettier": "^3.5.3",
31-
"ts-jest": "^29.4.0",
32-
"typescript": "^5.8.3"
29+
"husky": "^9.1.7",
30+
"jest": "^30.0.5",
31+
"prettier": "^3.6.2",
32+
"ts-jest": "^29.4.1",
33+
"typescript": "^5.9.2"
3334
}
3435
}

src/run.test.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe('run.ts', () => {
6767
expect(os.arch).toHaveBeenCalled()
6868
})
6969

70-
test('getHelmDownloadURL() - return the URL to download helm for Windows', () => {
70+
test('getHelmDownloadURL() - return the URL to download helm for Windows x64', () => {
7171
jest.spyOn(os, 'platform').mockReturnValue('win32')
7272
jest.spyOn(os, 'arch').mockReturnValue('x64')
7373

@@ -76,6 +76,15 @@ describe('run.ts', () => {
7676
expect(os.platform).toHaveBeenCalled()
7777
})
7878

79+
test('getHelmDownloadURL() - return the URL to download helm for Windows arm64', () => {
80+
jest.spyOn(os, 'platform').mockReturnValue('win32')
81+
jest.spyOn(os, 'arch').mockReturnValue('arm64')
82+
83+
const expected = 'https://test.tld/helm-v3.8.0-windows-arm64.zip'
84+
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(expected)
85+
expect(os.platform).toHaveBeenCalled()
86+
})
87+
7988
test('getLatestHelmVersion() - return the latest version of HELM', async () => {
8089
const res = {
8190
status: 200,
@@ -88,7 +97,7 @@ describe('run.ts', () => {
8897
test('getLatestHelmVersion() - return the stable version of HELM when simulating a network error', async () => {
8998
const errorMessage: string = 'Network Error'
9099
global.fetch = jest.fn().mockRejectedValueOnce(new Error(errorMessage))
91-
expect(await run.getLatestHelmVersion()).toBe('v3.18.3')
100+
expect(await run.getLatestHelmVersion()).toBe(run.stableHelmVersion)
92101
})
93102

94103
test('getValidVersion() - return version with v prepended', () => {
@@ -204,6 +213,7 @@ describe('run.ts', () => {
204213
const response = JSON.stringify([{tag_name: 'v4.0.0'}])
205214
jest.spyOn(fs, 'readFileSync').mockReturnValue(response)
206215
jest.spyOn(os, 'platform').mockReturnValue('win32')
216+
jest.spyOn(os, 'arch').mockReturnValue('x64')
207217
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {})
208218
jest.spyOn(toolCache, 'extractZip').mockResolvedValue('extractedPath')
209219
jest.spyOn(toolCache, 'cacheDir').mockResolvedValue('pathToCachedDir')
@@ -239,6 +249,7 @@ describe('run.ts', () => {
239249
throw 'Unable to download'
240250
})
241251
jest.spyOn(os, 'platform').mockReturnValue('win32')
252+
jest.spyOn(os, 'arch').mockReturnValue('x64')
242253

243254
const downloadUrl = 'https://test.tld/helm-v3.2.1-windows-amd64.zip'
244255
await expect(run.downloadHelm(downloadBaseURL, 'v3.2.1')).rejects.toThrow(
@@ -254,6 +265,7 @@ describe('run.ts', () => {
254265
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool')
255266
jest.spyOn(toolCache, 'extractZip').mockResolvedValue('extractedPath')
256267
jest.spyOn(os, 'platform').mockReturnValue('win32')
268+
jest.spyOn(os, 'arch').mockReturnValue('x64')
257269
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {})
258270
jest
259271
.spyOn(fs, 'readdirSync')
@@ -283,6 +295,7 @@ describe('run.ts', () => {
283295
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool')
284296
jest.spyOn(toolCache, 'extractZip').mockResolvedValue('extractedPath')
285297
jest.spyOn(os, 'platform').mockReturnValue('win32')
298+
jest.spyOn(os, 'arch').mockReturnValue('x64')
286299
jest.spyOn(fs, 'chmodSync').mockImplementation()
287300
jest.spyOn(fs, 'readdirSync').mockImplementation((file, _) => [])
288301
jest.spyOn(fs, 'statSync').mockImplementation((file) => {

src/run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as toolCache from '@actions/tool-cache'
1010
import * as core from '@actions/core'
1111

1212
const helmToolName = 'helm'
13-
const stableHelmVersion = 'v3.18.3'
13+
export const stableHelmVersion = 'v3.18.3'
1414

1515
export async function run() {
1616
let version = core.getInput('version', {required: true})

0 commit comments

Comments
 (0)