Skip to content

Commit

Permalink
Refactor transform.ts and others
Browse files Browse the repository at this point in the history
  • Loading branch information
selfdocumentingcode committed Sep 15, 2024
1 parent d928180 commit 6edf446
Show file tree
Hide file tree
Showing 14 changed files with 812 additions and 441 deletions.
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

0 comments on commit 6edf446

Please sign in to comment.