Skip to content

Commit c38a587

Browse files
authored
Merge pull request #3014 from ROCm/datecheck61
make license check branch specific
2 parents 5ec76bd + e327db1 commit c38a587

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ jobs:
356356
with:
357357
python-version: 3.8
358358
- name: run License Check
359-
run: python3 tools/check_stamped.py
359+
run: python3 tools/check_stamped.py ${{ github.base_ref }}
360360

361361
linux:
362362

tools/check_stamped.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# in the license stamp, with the assumption being that any modifications/creations will need to be stamped to the year that the
3131
# modification/creation was made.
3232
#####################################################################################
33-
import subprocess, sys, datetime
33+
import subprocess, sys, datetime, argparse
3434

3535
debug = False
3636

@@ -111,14 +111,15 @@ def check_filename(filename: str, fileTuple: tuple or list) -> bool:
111111
return False
112112

113113

114-
def main() -> None:
114+
def main(branch) -> None:
115115
unsupported_file_types.extend(specificIgnores)
116116

117117
## Get a list of all files (not including deleted) that have changed/added in comparison to the latest Dev branch from MI Graphx
118118

119119
# Subprocess 1 is fetching the latest dev branch from the MIgraphX Url and naming it as 'FETCH_HEAD'
120120
subprocess.run(
121-
"git fetch https://github.com/ROCmSoftwarePlatform/AMDMIGraphX develop --quiet",
121+
"git fetch https://github.com/ROCmSoftwarePlatform/AMDMIGraphX {0} --quiet"
122+
.format(branch),
122123
shell=True,
123124
stdout=subprocess.PIPE)
124125

@@ -153,7 +154,7 @@ def main() -> None:
153154

154155
elif len(stampedFilesWithBadYear) > 0:
155156
print(
156-
f"\nError: The licenses for the following {str(len(stampedFilesWithBadYear))} file(s) either... do not match the year of commit, have a different copyright format or have not been synced from the latest develop branch:\n{str(stampedFilesWithBadYear)}\nThere is a license_stamper script (./tools/license_stamper.py), which you can run to automatically update and add any needed license stamps"
157+
f"\nError: The licenses for the following {str(len(stampedFilesWithBadYear))} file(s) either... do not match the year of commit, have a different copyright format or have not been synced from the latest {branch} branch:\n{str(stampedFilesWithBadYear)}\nThere is a license_stamper script (./tools/license_stamper.py), which you can run to automatically update and add any needed license stamps"
157158
)
158159
sys.exit(1)
159160

@@ -168,4 +169,9 @@ def main() -> None:
168169

169170

170171
if __name__ == "__main__":
171-
main()
172+
173+
parser = argparse.ArgumentParser()
174+
parser.add_argument("branch")
175+
args = parser.parse_args()
176+
177+
main(args.branch)

0 commit comments

Comments
 (0)