Skip to content

Commit 78cf982

Browse files
committed
Fix CompareMPS when files differ in length
If the files had different length, the script prints errors, but was not returning errors. This returns the correct exit flag. Closes #1188
1 parent 2e854ab commit 78cf982

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

.github/workflows/CompareMPS.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ jobs:
2828
with:
2929
issue-number: ${{ github.event.pull_request.number }}
3030
comment-author: "github-actions[bot]"
31-
body-includes: This was CompareMPS
31+
body-includes: CompareMPS report
3232
- name: Comment on PR with CompareMPS
3333
if: github.event.pull_request.head.repo.full_name == github.repository
3434
uses: peter-evans/create-or-update-comment@v4
3535
with:
3636
comment-id: ${{ steps.find-old-comment.outputs.comment-id }}
3737
issue-number: ${{ github.event.pull_request.number }}
3838
body: |
39+
## :robot: CompareMPS report
40+
3941
### :hourglass: Running MPS comparison
4042
4143
Please wait.
42-
43-
:robot: This was CompareMPS, we hope you have enjoyed this program.
4444
edit-mode: replace
4545
- name: Clone
4646
uses: actions/checkout@v4
@@ -59,9 +59,11 @@ jobs:
5959
- name: Create PR body
6060
if: failure()
6161
run: |
62-
echo '## :warning: MPS files differ
62+
echo '## :robot: CompareMPS report
63+
64+
### :warning: MPS files differ
6365
64-
### What to do?
66+
What to do?
6567
6668
#### :+1: If this is expected
6769
@@ -71,7 +73,7 @@ jobs:
7173
julia --project=. utils/scripts/model-mps-update.jl
7274
```
7375
74-
#### :-1: This is bad
76+
#### :-1: If this is bad
7577
7678
Then, review the log below to figure out why the files differ:
7779
@@ -84,8 +86,6 @@ jobs:
8486
</details>
8587
8688
For more details about this workflow, check <https://tulipaenergy.github.io/TulipaEnergyModel.jl/dev/91-developer/#Testing-the-generate-MPS-files>.
87-
88-
:robot: This was CompareMPS, we hope you have enjoyed this program.
8989
' >> body.md
9090
echo "::warning title=MPS files are different::$(cat body.md)"
9191
- name: Find Comment
@@ -95,7 +95,7 @@ jobs:
9595
with:
9696
issue-number: ${{ github.event.pull_request.number }}
9797
comment-author: "github-actions[bot]"
98-
body-includes: This was CompareMPS
98+
body-includes: CompareMPS report
9999
- name: Comment on PR with log if failed
100100
if: failure() && github.event.pull_request.head.repo.full_name == github.repository
101101
uses: peter-evans/create-or-update-comment@v4
@@ -111,7 +111,7 @@ jobs:
111111
comment-id: ${{ steps.find-comment.outputs.comment-id }}
112112
issue-number: ${{ github.event.pull_request.number }}
113113
body: |
114-
### :white_check_mark: MPS files match
114+
## :robot: CompareMPS report
115115
116-
:robot: This was CompareMPS, we hope you have enjoyed this program.
116+
### :white_check_mark: MPS files match
117117
edit-mode: replace

utils/scripts/model-mps-compare.jl

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function compare_mps(existing_mps_folder)
3939
new_lines = readlines(new_mps_file)
4040

4141
if length(existing_lines) != length(new_lines)
42+
no_issues = false
4243
@error "Files don't have the same size"
4344
else
4445
zipped_lines = zip(existing_lines, new_lines)

0 commit comments

Comments
 (0)