Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pull PR_TITLE into env #309

Merged
merged 2 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ jobs:
npx --offline commitlint -V --from 'origin/${{ github.base_ref }}' --to ${{ github.event.pull_request.head.sha }}
- name: Run Commitlint on PR Title
if: steps.commit.outcome == 'failure'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo '${{ github.event.pull_request.title }}' | npx --offline commitlint -V
echo '$PR_TITLE' | npx --offline commitlint -V
4 changes: 3 additions & 1 deletion lib/content/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ jobs:
{{ rootNpxPath }} --offline commitlint -V --from 'origin/$\{{ github.base_ref }}' --to $\{{ github.event.pull_request.head.sha }}
- name: Run Commitlint on PR Title
if: steps.commit.outcome == 'failure'
env:
PR_TITLE: $\{{ github.event.pull_request.title }}
run: |
echo '$\{{ github.event.pull_request.title }}' | {{ rootNpxPath }} --offline commitlint -V
echo '$PR_TITLE' | {{ rootNpxPath }} --offline commitlint -V
12 changes: 9 additions & 3 deletions tap-snapshots/test/apply/source-snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,10 @@ jobs:
npx --offline commitlint -V --from 'origin/\${{ github.base_ref }}' --to \${{ github.event.pull_request.head.sha }}
- name: Run Commitlint on PR Title
if: steps.commit.outcome == 'failure'
env:
PR_TITLE: \${{ github.event.pull_request.title }}
run: |
echo '\${{ github.event.pull_request.title }}' | npx --offline commitlint -V
echo '$PR_TITLE' | npx --offline commitlint -V

.github/workflows/release.yml
========================================
Expand Down Expand Up @@ -2332,8 +2334,10 @@ jobs:
npx --offline commitlint -V --from 'origin/\${{ github.base_ref }}' --to \${{ github.event.pull_request.head.sha }}
- name: Run Commitlint on PR Title
if: steps.commit.outcome == 'failure'
env:
PR_TITLE: \${{ github.event.pull_request.title }}
run: |
echo '\${{ github.event.pull_request.title }}' | npx --offline commitlint -V
echo '$PR_TITLE' | npx --offline commitlint -V

.github/workflows/release.yml
========================================
Expand Down Expand Up @@ -3760,8 +3764,10 @@ jobs:
npx --offline commitlint -V --from 'origin/\${{ github.base_ref }}' --to \${{ github.event.pull_request.head.sha }}
- name: Run Commitlint on PR Title
if: steps.commit.outcome == 'failure'
env:
PR_TITLE: \${{ github.event.pull_request.title }}
run: |
echo '\${{ github.event.pull_request.title }}' | npx --offline commitlint -V
echo '$PR_TITLE' | npx --offline commitlint -V

.github/workflows/release.yml
========================================
Expand Down
8 changes: 4 additions & 4 deletions test/bin/apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ t.afterEach(() => {

t.test('when npm_config_local_prefix is unset, does nothing', async (t) => {
await templateApply()
t.equal(process.exitCode, undefined, 'exitCode is unset')
t.notOk(process.exitCode, 'exitCode is unset')
})

t.test('when npm_config_global is true, does nothing', async (t) => {
process.env.npm_config_global = 'true'

await templateApply()
t.equal(process.exitCode, undefined, 'exitCode is unset')
t.notOk(process.exitCode, 'exitCode is unset')
})

t.test('with mocks', async (t) => {
process.env.npm_config_local_prefix = 'heynow'

await templateApply(() => {})
t.equal(process.exitCode, undefined, 'exitCode is unset')
t.notOk(process.exitCode, 'exitCode is unset')
})

t.test('error', async (t) => {
Expand All @@ -50,5 +50,5 @@ t.test('error', async (t) => {
await templateApply(() => {
throw new Error('apply')
})
t.equal(process.exitCode, 1, 'exitCode is unset')
t.ok(process.exitCode, 'exitCode is unset')
})
4 changes: 2 additions & 2 deletions test/bin/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ t.test('problems', async (t) => {
solution: 'solution2',
}])

t.equal(process.exitCode, 1, 'exit code')
t.ok(process.exitCode, 'exit code')
t.matchSnapshot(errors.join('\n'))
})

Expand All @@ -53,6 +53,6 @@ t.test('no problems', async (t) => {

await templateCheck(() => [])

t.equal(process.exitCode, undefined, 'exit code')
t.notOk(process.exitCode, 'exit code')
t.strictSame(errors, [], 'errors')
})