Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Allow external contributors to trigger PyCafe CI #826

Merged
merged 5 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -39,4 +39,4 @@ jobs:

- name: Create PyCafe links
run: |
hatch run python ../tools/pycafe/create_pycafe_links.py ${{ github.token }} ${{ github.repository }} ${{ github.event.number }} ${{ github.run_id }}
hatch run python ../tools/pycafe/create_pycafe_links.py ${{ github.token }} ${{ github.repository }} ${{ github.event.number }} ${{ github.event.workflow_run.id }} ${{ github.event.workflow_run.head_sha }}
11 changes: 6 additions & 5 deletions tools/pycafe/create_pycafe_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
REPO_NAME = sys.argv[2]
PR_NUMBER = int(sys.argv[3])
RUN_ID = sys.argv[4]
COMMIT_SHA = sys.argv[5]
WHL_FILE = next(Path("dist").glob("*.whl")).name
PYCAFE_URL = "https://py.cafe"
VIZRO_RAW_URL = "https://raw.githubusercontent.com/mckinsey/vizro"
Expand All @@ -34,13 +35,13 @@
# Get PR and commits
repo = g.get_repo(REPO_NAME)
pr = repo.get_pull(PR_NUMBER)
commit_sha = pr.head.sha
commit = repo.get_commit(commit_sha)
commit_sha_files = pr.head.sha
commit = repo.get_commit(COMMIT_SHA)


def generate_link(directory: str, extra_requirements: Optional[list[str]] = None):
"""Generate a PyCafe link for the example dashboards."""
base_url = f"{VIZRO_RAW_URL}/{commit_sha}/vizro-core/{directory}"
base_url = f"{VIZRO_RAW_URL}/{commit_sha_files}/vizro-core/{directory}"

# Requirements
requirements = "\n".join(
Expand Down Expand Up @@ -103,12 +104,12 @@ def post_comment(urls: dict[str, str]):
# Update the existing comment or create a new one
if bot_comment:
bot_comment.edit(
BOT_COMMENT_TEMPLATE.format(current_utc_time=current_utc_time, commit_sha=commit_sha, dashboards=dashboards)
BOT_COMMENT_TEMPLATE.format(current_utc_time=current_utc_time, commit_sha=COMMIT_SHA, dashboards=dashboards)
)
print("Comment updated on the pull request.") # noqa
else:
pr.create_issue_comment(
BOT_COMMENT_TEMPLATE.format(current_utc_time=current_utc_time, commit_sha=commit_sha, dashboards=dashboards)
BOT_COMMENT_TEMPLATE.format(current_utc_time=current_utc_time, commit_sha=COMMIT_SHA, dashboards=dashboards)
)
print("Comment added to the pull request.") # noqa

Expand Down
2 changes: 1 addition & 1 deletion vizro-core/examples/scratch_dev/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


page = vm.Page(
title="Test I",
title="Test Ultimate",
components=[
vm.Graph(
figure=px.bar(
Expand Down
Loading