Skip to content

Commit

Permalink
fix: treatVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
samtrion committed Dec 21, 2023
1 parent 257b48a commit 2bff334
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 12 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function getInputs(inputs) {
export function getMetadata(metadata) {
if (metadata === undefined || metadata === null) {
return {
dependecyName: '',
dependecyNames: '',
dependecyType: '',
updateType: '',
ecosystem: '',
Expand All @@ -80,7 +80,7 @@ export function getMetadata(metadata) {
}

return {
dependecyName: metadata['dependency-name'],
dependecyNames: metadata['dependency-names'],
dependecyType: metadata['dependency-type'],
updateType: metadata['update-type'],
ecosystem: metadata['package-ecosystem'],
Expand Down Expand Up @@ -142,15 +142,19 @@ export function validatePullRequest(pull_request, config) {
}
}

const smallerOrEqualUpdateType =
updateTypesPriority.indexOf(targetUpdateType) >=
updateTypesPriority.indexOf(config.metadata.updateType)
const treatVersion =
targetUpdateType === updateTypes.any ||
updateTypesPriority.indexOf(config.metadata.updateType) <
updateTypesPriority.indexOf(targetUpdateType)

core.info(
`Check package '${config.metadata.dependecyName}' - Old: '${config.metadata.previousVersion}' New: '${config.metadata.newVersion}'`
`Check package '${config.metadata.dependecyNames}' - Old: '${config.metadata.previousVersion}' New: '${config.metadata.newVersion}'`
)
core.info(`Is the version treated? - ${smallerOrEqualUpdateType}`)
if (smallerOrEqualUpdateType) {
core.info(
`Target update type: ${targetUpdateType} - Update type: ${config.metadata.updateType}`
)
core.info(`Is the version treated? - ${treatVersion}`)
if (treatVersion) {
return {
execute: false,
validationState: state.skipped,
Expand Down

0 comments on commit 2bff334

Please sign in to comment.