3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-18 09:44:46 +00:00

chore: conditionally skip certain test for foked prs (#2240)

Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
This commit is contained in:
Tonye Jack 2024-08-21 03:13:53 -06:00 committed by GitHub
parent 525aabbe28
commit 46a4c027a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -659,8 +659,13 @@ describe('utils test', () => {
}) })
}) })
describe('getPreviousGitTag', () => { 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 // 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 () => { it('should return the second latest tag and its SHA when multiple tags are present', async () => {
if (shouldSkip) {
return
}
const result = await getPreviousGitTag({ const result = await getPreviousGitTag({
cwd: '.', cwd: '.',
tagsPattern: '*', tagsPattern: '*',
@ -672,9 +677,11 @@ describe('utils test', () => {
sha: 'f0751de6af436d4e79016e2041cf6400e0833653' sha: 'f0751de6af436d4e79016e2041cf6400e0833653'
}) })
}) })
// Tags are filtered by a specified pattern when 'tagsPattern' is provided // Tags are filtered by a specified pattern when 'tagsPattern' is provided
it('should filter tags by the specified pattern', async () => { it('should filter tags by the specified pattern', async () => {
if (shouldSkip) {
return
}
const result = await getPreviousGitTag({ const result = await getPreviousGitTag({
cwd: '.', cwd: '.',
tagsPattern: 'v1.*', tagsPattern: 'v1.*',
@ -686,9 +693,11 @@ describe('utils test', () => {
sha: 'f0751de6af436d4e79016e2041cf6400e0833653' sha: 'f0751de6af436d4e79016e2041cf6400e0833653'
}) })
}) })
// Tags are excluded by a specified ignore pattern when 'tagsIgnorePattern' is provided // Tags are excluded by a specified ignore pattern when 'tagsIgnorePattern' is provided
it('should exclude tags by the specified ignore pattern', async () => { it('should exclude tags by the specified ignore pattern', async () => {
if (shouldSkip) {
return
}
const result = await getPreviousGitTag({ const result = await getPreviousGitTag({
cwd: '.', cwd: '.',
tagsPattern: '*', tagsPattern: '*',