Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #97 from tinact/fixed/sort
Browse files Browse the repository at this point in the history
Fixed/sort
  • Loading branch information
sbaerlocher authored Jun 3, 2021
2 parents 7f160f2 + 651e35e commit c121d37
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
and [human-readable changelog](https://keepachangelog.com/en/1.0.0/).

## 1.0.3

## Fixed

- Fixing the sorting of larger numbers.

## 1.0.2

### Changed
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ function run() {
axios_1.default
.get(`https://hub.docker.com/v2/repositories/${imageName}/tags/`)
.then(response => {
const latest = _.last(_.remove(_.sortBy(_.map(response.data.results, 'name')), function (e) {
const latest = _.last(_.remove(_.map(response.data.results, 'name').sort((a, b) => a.localeCompare(b, undefined, { numeric: true })), function (e) {
return semver.validRange(e);
}));
core.setOutput('latest', latest);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "lib/main.js",
"scripts": {
"build": "tsc",
"lint": "eslint src/**/*.ts",
"lint": "eslint src/**/*.ts --fix",
"pack": "ncc build lib/main.js",
"test": "jest",
"all": "npm run build && npm run lint && npm run pack"
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function run(): Promise<void> {
.then(response => {
const latest = _.last(
_.remove(
_.sortBy(_.map(response.data.results, 'name')),
_.map(response.data.results, 'name').sort( (a, b) => a.localeCompare(b, undefined, { numeric:true }) ),
function (e) {
return semver.validRange(e)
}
Expand Down

0 comments on commit c121d37

Please sign in to comment.