Skip to content

Commit

Permalink
python api
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschulz-COL committed Oct 17, 2024
1 parent ce3cfc8 commit 185c78b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pycafe-dashboards-in-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Run Github Tool
run: |
cd vizro-core
hatch run python ../tools/pycafe/test.py $GH_TOKEN ${{ env.COMMIT_HASH }} ${{ env.RUN_ID }}
hatch run python ../tools/pycafe/test.py $GH_TOKEN mckinsey/vizro 766
- name: Create Check Run
env:
Expand Down
19 changes: 12 additions & 7 deletions tools/pycafe/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,31 @@
access_token = sys.argv[1]
g = Github(access_token)

# for repo in g.get_user().get_repos():
# print(repo.name)

print(sys.argv)
repo = sys.argv[1]
pr = sys.argv[2]
type = sys.argv[3]
code = sys.argv[4]
requirements = sys.argv[5]
repo = sys.argv[2]
pr = sys.argv[3]
# type = sys.argv[3]
# code = sys.argv[4]
# requirements = sys.argv[5]

# Get the repository
repo = g.get_repo(repo)

# Get the pull request
pr_number = int(pr)
pr = repo.get_pull(pr_number)
print(pr)

base_url = f"https://py.cafe/snippet/{type}/v1"
url = f"{base_url}#code={quote(code)}&requirements={quote(requirements)}"
# base_url = f"https://py.cafe/snippet/{type}/v1"
url = "https://py.cafe/snippet/vizro/v1"#f"{base_url}#code={quote(code)}&requirements={quote(requirements)}"

# # Get the latest commit SHA from the PR
if 1:
commit_sha = pr.head.sha
print(commit_sha)

# Define the deployment status
state = "success" # Options: 'error', 'failure', 'pending', 'success'
Expand Down

0 comments on commit 185c78b

Please sign in to comment.