Skip to content

Commit

Permalink
Merge pull request #3014 from ROCm/datecheck61
Browse files Browse the repository at this point in the history
make license check branch specific
  • Loading branch information
vamovsik authored May 6, 2024
2 parents 5ec76bd + e327db1 commit c38a587
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ jobs:
with:
python-version: 3.8
- name: run License Check
run: python3 tools/check_stamped.py
run: python3 tools/check_stamped.py ${{ github.base_ref }}

linux:

Expand Down
16 changes: 11 additions & 5 deletions tools/check_stamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# in the license stamp, with the assumption being that any modifications/creations will need to be stamped to the year that the
# modification/creation was made.
#####################################################################################
import subprocess, sys, datetime
import subprocess, sys, datetime, argparse

debug = False

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


def main() -> None:
def main(branch) -> None:
unsupported_file_types.extend(specificIgnores)

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

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

Expand Down Expand Up @@ -153,7 +154,7 @@ def main() -> None:

elif len(stampedFilesWithBadYear) > 0:
print(
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"
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"
)
sys.exit(1)

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


if __name__ == "__main__":
main()

parser = argparse.ArgumentParser()
parser.add_argument("branch")
args = parser.parse_args()

main(args.branch)

0 comments on commit c38a587

Please sign in to comment.