From 15a28bc600b9d0d8fcbdd7a871b32ffa26672d64 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Wed, 30 Nov 2022 14:16:00 +0100 Subject: [PATCH 1/3] Upgrade `@actions/core` --- package.json | 2 +- yarn.lock | 28 ++++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ed2dc01c..5bc447a0 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "author": "Dan Freeman", "license": "MIT", "dependencies": { - "@actions/core": "^1.2.0", + "@actions/core": "^1.10.0", "execa": "^4.0.0", "glob": "^7.1.6" }, diff --git a/yarn.lock b/yarn.lock index b8befa9b..8b78edbb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,20 @@ # yarn lockfile v1 -"@actions/core@^1.2.0": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.2.tgz#3c4848d50378f9e3bcb67bcf97813382ec7369ee" - integrity sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg== +"@actions/core@^1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f" + integrity sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug== + dependencies: + "@actions/http-client" "^2.0.1" + uuid "^8.3.2" + +"@actions/http-client@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.0.1.tgz#873f4ca98fe32f6839462a6f046332677322f99c" + integrity sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw== + dependencies: + tunnel "^0.0.6" "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": version "7.8.3" @@ -3703,6 +3713,11 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" +tunnel@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" + integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== + tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" @@ -3775,6 +3790,11 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + v8-compile-cache@^2.0.3: version "2.1.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" From 97a5b4abeebca509a179483e2d349b69a12e57bc Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Wed, 30 Nov 2022 14:16:07 +0100 Subject: [PATCH 2/3] Update expected test output --- __tests__/main.test.ts | 47 ++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 11162ab1..7498f107 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -33,14 +33,17 @@ describe('with a changed version', () => { await execa('git', ['rev-parse', 'v2.0.0']); await execa('git', ['rev-parse', 'v2.0.0'], { cwd: 'upstream' }); - expect(result.stdout.trim().split('\n')).toEqual([ - 'Previous version: 1.2.3', - '::set-output name=previous-version::1.2.3', - 'Current version: 2.0.0', - '::set-output name=current-version::2.0.0', - 'Creating tag v2.0.0', - '::set-output name=tag::v2.0.0', - ]); + expect(result.stdout).toMatchInlineSnapshot(` + "Previous version: 1.2.3 + + ::set-output name=previous-version::1.2.3 + Current version: 2.0.0 + + ::set-output name=current-version::2.0.0 + Creating tag v2.0.0 + + ::set-output name=tag::v2.0.0" + `); }); test('skips tag creation when configured to', async () => { @@ -51,12 +54,14 @@ describe('with a changed version', () => { }, }); - expect(result.stdout.trim().split('\n')).toEqual([ - 'Previous version: 1.2.3', - '::set-output name=previous-version::1.2.3', - 'Current version: 2.0.0', - '::set-output name=current-version::2.0.0', - ]); + expect(result.stdout).toMatchInlineSnapshot(` + "Previous version: 1.2.3 + + ::set-output name=previous-version::1.2.3 + Current version: 2.0.0 + + ::set-output name=current-version::2.0.0" + `); }); }); @@ -71,11 +76,13 @@ describe('with no version change', () => { }, }); - expect(result.stdout.trim().split('\n')).toEqual([ - 'Previous version: 1.2.3', - '::set-output name=previous-version::1.2.3', - 'Current version: 1.2.3', - '::set-output name=current-version::1.2.3', - ]); + expect(result.stdout).toMatchInlineSnapshot(` + "Previous version: 1.2.3 + + ::set-output name=previous-version::1.2.3 + Current version: 1.2.3 + + ::set-output name=current-version::1.2.3" + `); }); }); From e2bc8b362c2e4a2e9121c65769e6f5a447f55b3c Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Wed, 30 Nov 2022 14:19:42 +0100 Subject: [PATCH 3/3] Don't confuse the test environment for a real Actions env --- __tests__/main.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 7498f107..4726cba1 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -5,12 +5,20 @@ import { initRepository, addAndTrackRemote } from './helpers/git'; runTestsInScratchDirectory(); +let originalOutput = process.env.GITHUB_OUTPUT; + beforeEach(async () => { await initRepository(process.cwd()); fs.writeFileSync('package.json', JSON.stringify({ version: '1.2.3' })); await execa('git', ['add', 'package.json']); await execa('git', ['commit', '-m', 'Add package.json']); + + delete process.env.GITHUB_OUTPUT; +}); + +afterEach(() => { + process.env.GITHUB_OUTPUT = originalOutput; }); describe('with a changed version', () => {