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

Refactor transform.ts and others #1373

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: 'CI'
name: "CI"
on:
push:
tags:
- '*'
- "*"
pull_request:

concurrency:
Expand All @@ -25,13 +25,13 @@ jobs:
- name: Install NPM
run: |
npm install

- name: Run NPM
run: |
npm run all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Echo Configuration without Checkout Changelog
env:
CHANGELOG: ${{ steps.without_checkout.outputs.changelog }}
Expand All @@ -89,7 +89,7 @@ jobs:
uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Echo Minimal Configuration Changelog
env:
CHANGELOG: ${{ steps.minimal_release.outputs.changelog }}
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
token: ${{ secrets.PERSONAL_TOKEN }}
exportCache: true
exportOnly: true

- name: "External Repo Configuration"
id: external_changelog
uses: ./
Expand Down Expand Up @@ -188,4 +188,3 @@ jobs:
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-b') || contains(github.ref, '-a') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

10 changes: 9 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
"arrowParens": "avoid",
"overrides": [
{
"files": ["*.yml", "*.yaml"],
"options": {
"singleQuote": false
}
}
]
}
2 changes: 1 addition & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('missing values should result in failure', () => {
}
try {
cp.execSync(`node ${ip}`, options).toString()
} catch (error: any) {
} catch (error: unknown) {
expect(true).toBe(true)
}
})
Expand Down
4 changes: 2 additions & 2 deletions __tests__/releaseNotesBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ it('[Github] Uncategorized category', async () => {
})

it('[Github] Verify commit based changelog', async () => {
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_commits.json'))
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_commits.json'), 'COMMIT')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
githubRepository,
Expand Down Expand Up @@ -257,7 +257,7 @@ it('[Github] Verify commit based changelog', async () => {
})

it('[Github] Verify commit based changelog, with emoji categorisation', async () => {
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_commits_emoji.json'))
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_commits_emoji.json'), 'COMMIT')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
githubRepository,
Expand Down
4 changes: 3 additions & 1 deletion __tests__/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ it('Extract label from title, split regex', async () => {
on_property: 'title'
}
]

expect(buildChangelogTest(configuration, mergedPullRequests, repositoryUtils)).toStrictEqual(
`## 🚀 Features\n\n- [Feature][AB-1234] - this is a PR 1 title message\n - PR: #1\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [Issue][AB-4321] - this is a PR 2 title message\n - PR: #2\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n`
)
Expand Down Expand Up @@ -448,7 +449,8 @@ it('Use empty_content for empty category', async () => {
labels: ['Feature']
}
]
expect(buildChangelogTest(customConfig, pullRequestsWithLabels, repositoryUtils)).toStrictEqual(
const changelog = buildChangelogTest(customConfig, pullRequestsWithLabels, repositoryUtils)
expect(changelog).toStrictEqual(
`## 🚀 Features and 🐛 Issues\n\n- No PRs in this category\n\n## 🚀 Features\n\n- [ABC-1234] - this is a PR 1 title message\n - PR: #1\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n\n`
)
})
Expand Down
Loading
Loading