Skip to content

Commit

Permalink
chore: conditionally skip certain test for foked prs (#2240)
Browse files Browse the repository at this point in the history
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
  • Loading branch information
jackton1 and tj-actions-bot authored Aug 21, 2024
1 parent 525aabb commit 46a4c02
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '*',
Expand All @@ -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.*',
Expand All @@ -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: '*',
Expand Down

0 comments on commit 46a4c02

Please sign in to comment.