Skip to content

Commit

Permalink
[install] in archiver.py/yml get the repo owner/name from the github ci
Browse files Browse the repository at this point in the history
  • Loading branch information
valassi committed Oct 1, 2024
1 parent 3736647 commit f3bd383
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
import subprocess
import sys

def get_repo():
out = subprocess.check_output(['git', 'config', '--get', 'remote.origin.url']).decode()
return out.split(':')[1].split('.')[0].split('/') # returns (repo_owner, repo_name)

def get_all_tags():
out = subprocess.check_output(['git', 'tag']).decode()
return out.split('\n')
Expand All @@ -27,16 +23,18 @@ def create_infodat_file(path, versions):
fsock.write(line%{'repo':GITHUB_REPO, 'prefix':PREFIX, 'version':v, 'suffix':SUFFIX})

if "__main__" == __name__:
if len(sys.argv) != 2:
print('Usage: python3 %s <infodat>'%sys.argv[0])
if len(sys.argv) != 3:
print('Usage: python3 %s <repoowner/reponame> <infodat>'%sys.argv[0])
sys.exit(1)
repo_owner, repo_name = get_repo()
repo = sys.argv[1]
infodat = sys.argv[2]
repo_owner, repo_name = repo.split('/')
###print('Repo owner:', repo_owner)
###print('Repo name:', repo_name)
GITHUB_REPO = '%s/%s/'%(repo_owner, repo_name)
PREFIX = 'cudacpp_for'
if repo_owner != 'madgraph5' : PREFIX = repo_owner + "_" + PREFIX # TEMPORARY! this will change eventually...
if repo_name != 'madgraph4gpu' : raise Exception('Invalid repo_name (expect "madgraph4gpu")') # TEMPORARY! this will change eventually...
if repo_name != 'madgraph4gpu' : raise Exception('Invalid repo_name "%s" (expect "madgraph4gpu")'%repo_name) # TEMPORARY! this will change eventually...
SUFFIX = '_latest'
tags = get_all_tags()
###print('Tags:', tags)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/archiver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ jobs:
cd branch_PR
echo "Current directory is now $(pwd)"
echo "Current branch is \"$(git branch | \grep ^* | sed 's/^* //')\""
python3 .github/workflows/archiver.py version_info.dat
python3 .github/workflows/archiver.py ${{ github.repository }} version_info.dat
mv version_info.dat ${WORKDIR}
echo "Created version_info.dat"
python3 -c 'print("-"*132)'
Expand Down

0 comments on commit f3bd383

Please sign in to comment.