From de5a000abf73b6f4965bd1bcdf8f8d94a56ea815 Mon Sep 17 00:00:00 2001 From: Orhan Toy Date: Wed, 2 Oct 2024 02:24:28 +0200 Subject: [PATCH 1/3] Check out other refs/* by commit if provided, fall back to ref (#1924) --- __test__/ref-helper.test.ts | 10 ++++++++++ dist/index.js | 4 ++-- src/ref-helper.ts | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/__test__/ref-helper.test.ts b/__test__/ref-helper.test.ts index d3b00b7af..5c8d76b87 100644 --- a/__test__/ref-helper.test.ts +++ b/__test__/ref-helper.test.ts @@ -77,6 +77,16 @@ describe('ref-helper tests', () => { expect(checkoutInfo.startPoint).toBeFalsy() }) + it('getCheckoutInfo refs/ without commit', async () => { + const checkoutInfo = await refHelper.getCheckoutInfo( + git, + 'refs/non-standard-ref', + '' + ) + expect(checkoutInfo.ref).toBe('refs/non-standard-ref') + expect(checkoutInfo.startPoint).toBeFalsy() + }) + it('getCheckoutInfo unqualified branch only', async () => { git.branchExists = jest.fn(async (remote: boolean, pattern: string) => { return true diff --git a/dist/index.js b/dist/index.js index 2b7dd09e0..d86415e06 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2005,8 +2005,8 @@ function getCheckoutInfo(git, ref, commit) { result.ref = ref; } // refs/ - else if (upperRef.startsWith('REFS/') && commit) { - result.ref = commit; + else if (upperRef.startsWith('REFS/')) { + result.ref = commit ? commit : ref; } // Unqualified ref, check for a matching branch or tag else { diff --git a/src/ref-helper.ts b/src/ref-helper.ts index 00a1d27c3..58f929098 100644 --- a/src/ref-helper.ts +++ b/src/ref-helper.ts @@ -46,8 +46,8 @@ export async function getCheckoutInfo( result.ref = ref } // refs/ - else if (upperRef.startsWith('REFS/') && commit) { - result.ref = commit + else if (upperRef.startsWith('REFS/')) { + result.ref = commit ? commit : ref } // Unqualified ref, check for a matching branch or tag else { From 6b42224f41ee5dfe5395e27c8b2746f1f9955030 Mon Sep 17 00:00:00 2001 From: Joel Ambass Date: Thu, 3 Oct 2024 11:03:35 +0200 Subject: [PATCH 2/3] Add workflow file for publishing releases to immutable action package (#1919) This workflow file publishes new action releases to the immutable action package of the same name as this repo. This is part of the Immutable Actions project which is not yet fully released to the public. First party actions like this one are part of our initial testing of this feature. --- .../workflows/publish-immutable-actions.yml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/publish-immutable-actions.yml diff --git a/.github/workflows/publish-immutable-actions.yml b/.github/workflows/publish-immutable-actions.yml new file mode 100644 index 000000000..87c020728 --- /dev/null +++ b/.github/workflows/publish-immutable-actions.yml @@ -0,0 +1,20 @@ +name: 'Publish Immutable Action Version' + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + packages: write + + steps: + - name: Checking out + uses: actions/checkout@v4 + - name: Publish + id: publish + uses: actions/publish-immutable-action@0.0.3 From eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Mon, 7 Oct 2024 12:38:04 -0400 Subject: [PATCH 3/3] Prepare 4.2.1 release (#1925) --- CHANGELOG.md | 3 +++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 877a50fb7..b127df3dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v4.2.1 +* Check out other refs/* by commit if provided, fall back to ref by @orhantoy in https://github.com/actions/checkout/pull/1924 + ## v4.2.0 * Add Ref and Commit outputs by @lucacome in https://github.com/actions/checkout/pull/1180 diff --git a/package-lock.json b/package-lock.json index a84d3bd8d..281b2eaf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "checkout", - "version": "4.2.0", + "version": "4.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "checkout", - "version": "4.2.0", + "version": "4.2.1", "license": "MIT", "dependencies": { "@actions/core": "^1.10.1", diff --git a/package.json b/package.json index cdccbfc33..e145004cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "checkout", - "version": "4.2.0", + "version": "4.2.1", "description": "checkout action", "main": "lib/main.js", "scripts": {