chore: Test expectedCommands for skipping git pulls

releases/v3
apr-1985 2021-11-17 10:33:20 +00:00
parent f7c266a578
commit c9222a9423
2 changed files with 6 additions and 7 deletions

View File

@ -1,8 +1,5 @@
name: 'Test the action' name: 'Test the action'
on: on:
push:
branches:
- skip_git_pull-1
pull_request: pull_request:
branches: branches:
- master - master
@ -129,7 +126,6 @@ jobs:
- run: git tag | xargs git tag -d - run: git tag | xargs git tag -d
- name: Create fake tag - name: Create fake tag
run: "git tag -a 'v0.55.8' -m 'v0.55.8'" 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'" - run: "git add . && git commit -m 'fix: Added fake file so version will be bumped'"
- name: Generate changelog - name: Generate changelog
@ -159,7 +155,6 @@ jobs:
- run: git tag | xargs git tag -d - run: git tag | xargs git tag -d
- name: Create fake tag - name: Create fake tag
run: "git tag -a 'v0.55.8' -m 'v0.55.8'" 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'" - run: "git add . && git commit -m 'fix: Added fake file so version will be bumped'"
- name: Generate changelog - name: Generate changelog
@ -169,6 +164,7 @@ jobs:
ENV: 'dont-use-git' ENV: 'dont-use-git'
EXPECTED_TAG: 'v0.55.9' EXPECTED_TAG: 'v0.55.9'
SKIPPED_COMMIT: true SKIPPED_COMMIT: true
SKIPPED_PULL: true
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
skip-commit: 'true' skip-commit: 'true'

View File

@ -161,14 +161,17 @@ module.exports = new (class Git {
*/ */
testHistory = () => { testHistory = () => {
if (ENV === 'dont-use-git') { 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 = [ const expectedCommands = [
'git config user.name "Conventional Changelog Action"', 'git config user.name "Conventional Changelog Action"',
'git config user.email "conventional.changelog.action@github.com"', '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) { if (!SKIPPED_COMMIT) {
expectedCommands.push('git add .') expectedCommands.push('git add .')
expectedCommands.push(`git commit -m "chore(release): ${EXPECTED_TAG}"`) expectedCommands.push(`git commit -m "chore(release): ${EXPECTED_TAG}"`)