From 46a4c027a6ca424288bffcec07df0f9c6a22ad04 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 21 Aug 2024 03:13:53 -0600 Subject: [PATCH] chore: conditionally skip certain test for foked prs (#2240) Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com> --- src/__tests__/utils.test.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/__tests__/utils.test.ts b/src/__tests__/utils.test.ts index 15eb0d15..59b4e022 100644 --- a/src/__tests__/utils.test.ts +++ b/src/__tests__/utils.test.ts @@ -659,8 +659,13 @@ describe('utils test', () => { }) }) describe('getPreviousGitTag', () => { + // Check if the environment variable GITHUB_REPOSITORY_OWNER is 'tj-actions' + const shouldSkip = process.env.GITHUB_REPOSITORY_OWNER !== 'tj-actions' // Function returns the second-latest tag and its SHA it('should return the second latest tag and its SHA when multiple tags are present', async () => { + if (shouldSkip) { + return + } const result = await getPreviousGitTag({ cwd: '.', tagsPattern: '*', @@ -672,9 +677,11 @@ describe('utils test', () => { sha: 'f0751de6af436d4e79016e2041cf6400e0833653' }) }) - // Tags are filtered by a specified pattern when 'tagsPattern' is provided it('should filter tags by the specified pattern', async () => { + if (shouldSkip) { + return + } const result = await getPreviousGitTag({ cwd: '.', tagsPattern: 'v1.*', @@ -686,9 +693,11 @@ describe('utils test', () => { sha: 'f0751de6af436d4e79016e2041cf6400e0833653' }) }) - // Tags are excluded by a specified ignore pattern when 'tagsIgnorePattern' is provided it('should exclude tags by the specified ignore pattern', async () => { + if (shouldSkip) { + return + } const result = await getPreviousGitTag({ cwd: '.', tagsPattern: '*',