Skip to content

Commit 756626e

Browse files
authored
👷 Update docs-previews to handle no docs changes (#1056)
1 parent d921fb8 commit 756626e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ jobs:
6464
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
6565
branch: ${{ ( github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'main' && 'main' ) || ( github.event.workflow_run.head_sha ) }}
6666
- name: Comment Deploy
67-
if: steps.deploy.outputs.url != ''
6867
run: python ./scripts/deploy_docs_status.py
6968
env:
7069
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7170
DEPLOY_URL: ${{ steps.deploy.outputs.url }}
7271
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
7372
RUN_ID: ${{ github.run_id }}
73+
IS_DONE: "true"

scripts/deploy_docs_status.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Settings(BaseSettings):
1212
deploy_url: str | None = None
1313
commit_sha: str
1414
run_id: int
15+
is_done: bool = False
1516

1617

1718
def main():
@@ -30,18 +31,27 @@ def main():
3031
commits = list(use_pr.get_commits())
3132
current_commit = [c for c in commits if c.sha == settings.commit_sha][0]
3233
run_url = f"https://github.com/{settings.github_repository}/actions/runs/{settings.run_id}"
34+
if settings.is_done and not settings.deploy_url:
35+
current_commit.create_status(
36+
state="success",
37+
description="No Docs Changes",
38+
context="deploy-docs",
39+
target_url=run_url,
40+
)
41+
logging.info("No docs changes found")
42+
return
3343
if not settings.deploy_url:
3444
current_commit.create_status(
3545
state="pending",
36-
description="Deploy Docs",
46+
description="Deploying Docs",
3747
context="deploy-docs",
3848
target_url=run_url,
3949
)
4050
logging.info("No deploy URL available yet")
4151
return
4252
current_commit.create_status(
4353
state="success",
44-
description="Deploy Docs",
54+
description="Docs Deployed",
4555
context="deploy-docs",
4656
target_url=run_url,
4757
)

0 commit comments

Comments
 (0)