Skip to content

Commit

Permalink
fix: regex format default
Browse files Browse the repository at this point in the history
  • Loading branch information
thedaviddias committed Aug 3, 2023
1 parent 72b486c commit d85455d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
| --------------------------- | -------- | --------------------------- | --------------------------------------------------------------------------------------------------------- |
| `github_token` | yes | | Token to use to authorize label changes. Typically the GITHUB_TOKEN secret |
| `repo` | no | | Name of the repo (e.g. owner/repo) if not the current one |
| `tag_regex` | no | ^v[0-9]+\\.[0-9]+\\.[0-9]+$ | Regex to accommodate varying tag formatting |
| `tag_regex` | no | ^v[0-9]+\\.[0-9]+\\.[0-9]+$ | Regex to accommodate varying tag formatting. Don't forget to double-escape special characters |
| `time_zone_offset` | no | 0 | Timezone offset in minutes from UTC. |
| `contributor_replace_regex` | no | | Regular expression (regex) pattern to identify characters in the `contributor` name that will be replaced |
| `contributor_replace_char` | no | | The character that will replace specific characters in the `contributor` name |
Expand Down
7 changes: 1 addition & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inputs:
tag_regex:
description: 'A regular expression to match against git tags. The first capture group should be the version number.'
required: false
default: '^v[0-9]+\\.[0-9]+\\.[0-9]+$' # Matches the "v" prefix by default
default: '^v[0-9]+\\.[0-9]+\\.[0-9]+$' # Matches the semver notation (v1.0.0") by default

contributor_replace_regex:
description: An optional regular expression (regex) pattern to identify characters in the `contributor` name that will be replaced.
Expand Down Expand Up @@ -53,11 +53,6 @@ inputs:
description: The URL link to the Grafana dashboard related to the repository. This link will be included in the Slack notification for easy access to relevant analytics.
required: false

time_zone_offset:
description: Timezone offset in minutes from UTC. Positive for timezones ahead of UTC, negative for those behind.
required: false
default: '0' # Default is 0, i.e., UTC time

runs:
using: node16
main: dist/index.js
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function run(): Promise<void> {
const previousVersionMatch = previousTag.name.match(tagRegex)

if (!currentVersionMatch || !previousVersionMatch) {
core.warning(
core.error(
'Current or previous tag does not match the provided regular expression. Exiting.'
)
return
Expand All @@ -57,7 +57,7 @@ export async function run(): Promise<void> {
const comparisonResult = compareSemVer(currentVersion, previousVersion)

if (comparisonResult <= 0) {
core.warning('Current tag is not greater than the previous tag. Exiting.')
core.error('Current tag is not greater than the previous tag. Exiting.')
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/__tests__/getTags.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('getTags', () => {
})
expect(core.info).toHaveBeenCalledWith('Getting list of tags')
expect(core.info).toHaveBeenCalledWith(
`Fetching commits between ${mockTags[1].name} and ${mockTags[0].name}`
`Fetching commits between ${mockTags[1].name} (previous tag) and ${mockTags[0].name} (current tag)`
)
})
})
4 changes: 3 additions & 1 deletion src/utils/getTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export async function getTags(
const { data } = await octokit.rest.repos.listTags({ owner, repo, per_page: 2 })
const [currentTag, previousTag] = data

core.info(`Fetching commits between ${previousTag.name} and ${currentTag.name}`)
core.info(
`Fetching commits between ${previousTag.name} (previous tag) and ${currentTag.name} (current tag)`
)

return { currentTag, previousTag }
}

0 comments on commit d85455d

Please sign in to comment.