Skip to content

Commit b4c0974

Browse files
authored
fix: update test skip logic to use custom env (#2242)
1 parent 246859d commit b4c0974

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ jobs:
6868

6969
- name: Run build and test
7070
run: |
71-
env
7271
yarn all
72+
env:
73+
GITHUB_EVENT_PULL_REQUEST_HEAD_REPO_FORK: ${{ github.event.pull_request.head.repo.fork }}
7374

7475
- name: Verify Changed files
7576
uses: tj-actions/verify-changed-files@v20

src/__tests__/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ describe('utils test', () => {
660660
})
661661
describe('getPreviousGitTag', () => {
662662
// Check if the environment variable GITHUB_REPOSITORY_OWNER is 'tj-actions'
663-
const shouldSkip = process.env.GITHUB_REPOSITORY_OWNER !== 'tj-actions'
663+
const shouldSkip = !!process.env.GITHUB_EVENT_PULL_REQUEST_HEAD_REPO_FORK
664664
// Function returns the second-latest tag and its SHA
665665
it('should return the second latest tag and its SHA when multiple tags are present', async () => {
666666
if (shouldSkip) {

0 commit comments

Comments
 (0)