From c9222a9423dd92ce64b0cfc8408bdd7902dbb2a7 Mon Sep 17 00:00:00 2001 From: apr-1985 Date: Wed, 17 Nov 2021 10:33:20 +0000 Subject: [PATCH] chore: Test expectedCommands for skipping git pulls --- .github/workflows/test.yml | 6 +----- src/helpers/git.js | 7 +++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4f861ea..eddf199 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,5 @@ name: 'Test the action' on: - push: - branches: - - skip_git_pull-1 pull_request: branches: - master @@ -129,7 +126,6 @@ jobs: - run: git tag | xargs git tag -d - name: Create fake tag run: "git tag -a 'v0.55.8' -m 'v0.55.8'" - - run: "echo 'askjfhsadjkfh' > banana.txt" - run: "git add . && git commit -m 'fix: Added fake file so version will be bumped'" - name: Generate changelog @@ -159,7 +155,6 @@ jobs: - run: git tag | xargs git tag -d - name: Create fake tag run: "git tag -a 'v0.55.8' -m 'v0.55.8'" - - run: "echo 'askjfhsadjkfh' > banana.txt" - run: "git add . && git commit -m 'fix: Added fake file so version will be bumped'" - name: Generate changelog @@ -169,6 +164,7 @@ jobs: ENV: 'dont-use-git' EXPECTED_TAG: 'v0.55.9' SKIPPED_COMMIT: true + SKIPPED_PULL: true with: github-token: ${{ secrets.github_token }} skip-commit: 'true' diff --git a/src/helpers/git.js b/src/helpers/git.js index f77058f..b35cf0c 100644 --- a/src/helpers/git.js +++ b/src/helpers/git.js @@ -161,14 +161,17 @@ module.exports = new (class Git { */ testHistory = () => { if (ENV === 'dont-use-git') { - const { EXPECTED_TAG, SKIPPED_COMMIT, EXPECTED_NO_PUSH } = process.env + const { EXPECTED_TAG, SKIPPED_COMMIT, EXPECTED_NO_PUSH, SKIPPED_PULL } = process.env const expectedCommands = [ 'git config user.name "Conventional Changelog Action"', 'git config user.email "conventional.changelog.action@github.com"', - 'git pull --tags --ff-only', ] + if (!SKIPPED_PULL) { + expectedCommands.push('git pull --tags --ff-only') + } + if (!SKIPPED_COMMIT) { expectedCommands.push('git add .') expectedCommands.push(`git commit -m "chore(release): ${EXPECTED_TAG}"`)