Skip to content

Commit 930e6a2

Browse files
authored
fix: handle sorting of keys with the same values (#20)
1 parent bebfffe commit 930e6a2

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "check-atlantis-action",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "Run set of checks on atlantis.yaml config file",
55
"main": "lib/main.js",
66
"scripts": {

src/checks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function checkOrdering(document: Project[]): string {
7070
core.info(`Sort projects by '${key}' key...`)
7171

7272
document.sort(function (a, b) {
73-
if (a[key] > b[key]) {
73+
if (a[key] >= b[key]) {
7474
return 1
7575
} else {
7676
checkStatus = 'fail'

tests/atlantis.yaml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
version: 3
22
projects:
3+
- name: module-b-2
4+
dir: tests/a/b
5+
autoplan:
6+
when_modified:
7+
- "*.tf"
8+
- modules/a/*.tf
9+
workflow: dev
10+
apply_requirements:
11+
- approved
312
- name: module-b
413
dir: tests/a/b
514
autoplan:
@@ -8,25 +17,29 @@ projects:
817
- "*.tfvars"
918
- modules/a/*.tf
1019
workflow: dev
11-
apply_requirements: [approved]
20+
apply_requirements:
21+
- approved
1222
- name: module-a
1323
dir: tests/a/c/b
1424
autoplan:
1525
when_modified:
1626
- "*.tf"
1727
workflow: dev
18-
apply_requirements: [approved]
28+
apply_requirements:
29+
- approved
1930
- name: module-foo
2031
dir: foo/bar
2132
autoplan:
2233
when_modified:
2334
- "*.tf"
2435
workflow: prod
25-
apply_requirements: [approved]
36+
apply_requirements:
37+
- approved
2638
- name: module-c
2739
dir: tests/a/c/a
2840
autoplan:
2941
when_modified:
3042
- "*.tf"
3143
workflow: dev
32-
apply_requirements: [approved]
44+
apply_requirements:
45+
- approved

0 commit comments

Comments
 (0)