Skip to content

Commit c9a3f21

Browse files
authored
Add python version into the file name of output files of primer (#6754)
1 parent 7d2cef4 commit c9a3f21

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

.github/workflows/primer_comment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
- name: Compare outputs
112112
run: |
113113
. venv/bin/activate
114-
python tests/primer/primer_tool.py compare --base-file=output_main.txt --new-file=output_pr.txt
114+
python tests/primer/primer_tool.py compare --base-file=output_${{ steps.python.outputs.python-version }}_main.txt --new-file=output_${{ steps.python.outputs.python-version }}_pr.txt
115115
- name: Post comment
116116
id: post-comment
117117
uses: actions/github-script@v6

.github/workflows/primer_run_main.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,6 @@ jobs:
101101
uses: actions/upload-artifact@v3
102102
with:
103103
name: primer_output
104-
path: tests/.pylint_primer_tests/output_main.txt
104+
path:
105+
tests/.pylint_primer_tests/output_${{ steps.python.outputs.python-version
106+
}}_main.txt

.github/workflows/primer_run_pr.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,14 @@ jobs:
172172
uses: actions/upload-artifact@v3
173173
with:
174174
name: primer_output_pr
175-
path: tests/.pylint_primer_tests/output_pr.txt
175+
path:
176+
tests/.pylint_primer_tests/output_${{ steps.python.outputs.python-version
177+
}}_pr.txt
176178
- name: Upload output of 'main'
177179
uses: actions/upload-artifact@v3
178180
with:
179181
name: primer_output_main
180-
path: output_main.txt
182+
path: output_${{ steps.python.outputs.python-version }}_main.txt
181183

182184
# Save PR number so we know which PR to comment on
183185
- name: Save PR number

tests/primer/primer_tool.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import argparse
88
import json
9+
import sys
910
from io import StringIO
1011
from pathlib import Path
1112
from typing import Dict, List, Union
@@ -126,7 +127,10 @@ def _handle_run_command(self) -> None:
126127
print(f"Successfully primed {package}.")
127128

128129
with open(
129-
PRIMER_DIRECTORY / f"output_{self.config.type}.txt", "w", encoding="utf-8"
130+
PRIMER_DIRECTORY
131+
/ f"output_{'.'.join(str(i) for i in sys.version_info[:3])}_{self.config.type}.txt",
132+
"w",
133+
encoding="utf-8",
130134
) as f:
131135
json.dump(packages, f)
132136

0 commit comments

Comments
 (0)