+
Skip to content

Conversation

PProfizi
Copy link
Contributor

@PProfizi PProfizi commented Aug 7, 2025

Moves the doc-deploy-pr action to a dedicated workflow triggered by a workflow_run completed on docs.yml, and deploying only if the PR is labeled with deploy-pr-doc.
The new workflow needs to be present in the main branch to be triggered.

@PProfizi PProfizi requested a review from moe-ad August 7, 2025 10:03
@PProfizi PProfizi self-assigned this Aug 7, 2025
@PProfizi PProfizi added CI/CD Related to CI/CD deploy-pr-doc For deploying a PR's documentation labels Aug 7, 2025
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.12%. Comparing base (4c983c5) to head (e27e5da).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2529   +/-   ##
=======================================
  Coverage   84.12%   84.12%           
=======================================
  Files          91       91           
  Lines       10703    10703           
=======================================
  Hits         9004     9004           
  Misses       1699     1699           

@PProfizi PProfizi merged commit dfba54e into main Aug 7, 2025
46 checks passed
@PProfizi PProfizi deleted the ci/extract_deploy_PR_doc_action branch August 7, 2025 12:28
Copy link
Contributor

@moe-ad moe-ad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PProfizi nice approach. I didn't even know an action exist for downloading artifacts from other workflows. I made some suggestions, especially wrt the need for the closed event to be present.

I still have a concern:
I think this shouldn't need to be on main before we can confirm that it works because reusable workflows are picked up from the current branch, the reason it currently doesn't get triggered might be because we run docs.yml from ci.yml, and it may not be considered valid for the workflow_run trigger. I may be wrong.

Comment on lines +1 to +46
name: doc-deploy-PR

on:
workflow_run:
workflows: [docs]
types: [completed]

env:
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'

jobs:
debug:
name: debug
runs-on: ubuntu-latest
env:
EVENT_OBJ: ${{ toJson(github.event) }}
steps:
- run: echo $EVENT_OBJ
doc-deploy-pr:
name: "Deploy PR documentation"
runs-on: ubuntu-latest
if: |
github.event.workflow_run.conclusion == 'success' &&
contains(github.event.workflow_run.pull_requests.*.labels.*.name, 'deploy-pr-doc')
steps:
- name: "Download artifacts"
uses: dawidd6/action-download-artifact@v11
with:
workflow: docs.yml
name: HTML-doc-ansys-dpf-core.zip
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}


- name: "Display downloaded files"
run: ls -R

- uses: ansys/actions/doc-deploy-pr@v10
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
maximum-pr-doc-deployments: 10 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: doc-deploy-PR
on:
workflow_run:
workflows: [docs]
types: [completed]
env:
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
jobs:
debug:
name: debug
runs-on: ubuntu-latest
env:
EVENT_OBJ: ${{ toJson(github.event) }}
steps:
- run: echo $EVENT_OBJ
doc-deploy-pr:
name: "Deploy PR documentation"
runs-on: ubuntu-latest
if: |
github.event.workflow_run.conclusion == 'success' &&
contains(github.event.workflow_run.pull_requests.*.labels.*.name, 'deploy-pr-doc')
steps:
- name: "Download artifacts"
uses: dawidd6/action-download-artifact@v11
with:
workflow: docs.yml
name: HTML-doc-ansys-dpf-core.zip
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
- name: "Display downloaded files"
run: ls -R
- uses: ansys/actions/doc-deploy-pr@v10
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
maximum-pr-doc-deployments: 10
name: doc-deploy-PR
on:
workflow_run:
workflows: [docs]
types: [completed]
pull_request:
types: [closed]
env:
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
jobs:
debug:
name: debug
runs-on: ubuntu-latest
env:
EVENT_OBJ: ${{ toJson(github.event) }}
steps:
- run: echo $EVENT_OBJ
doc-deploy-pr:
name: "Deploy PR documentation"
runs-on: ubuntu-latest
if: |
(
github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
contains(github.event.workflow_run.pull_requests.*.labels.*.name, 'deploy-pr-doc')
) || (
github.event_name == 'pull_request' &&
github.event.action == 'closed' &&
contains(github.event.pull_request.labels.*.name, 'deploy-pr-doc')
)
steps:
- name: Set PR number
id: pr
run: |
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
echo "pr_number=${{ fromJson(toJson(github.event.workflow_run.pull_requests[0])).number }}" >> "$GITHUB_OUTPUT"
else
echo "pr_number=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
fi
- name: Print PR number
run: echo "PR number is ${{ steps.pr.outputs.pr_number }}"
- name: Download artifacts (if workflow_run)
if: ${{ github.event_name == 'workflow_run' }}
uses: dawidd6/action-download-artifact@v11
with:
workflow: docs.yml
name: HTML-doc-ansys-dpf-core.zip
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
- name: Display downloaded files (if workflow_run)
if: ${{ github.event_name == 'workflow_run' }}
run: ls -R
- uses: ansys/actions/doc-deploy-pr@v10
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
maximum-pr-doc-deployments: 10

@PProfizi
Copy link
Contributor Author

PProfizi commented Aug 7, 2025

@PProfizi nice approach. I didn't even know an action exist for downloading artifacts from other workflows. I made some suggestions, especially wrt the need for the closed event to be present.

I still have a concern: I think this shouldn't need to be on main before we can confirm that it works because reusable workflows are picked up from the current branch, the reason it currently doesn't get triggered might be because we run docs.yml from ci.yml, and it may not be considered valid for the workflow_run trigger. I may be wrong.

According to the doc you can trigger up to 3 workflows in a sequence this way

@moe-ad
Copy link
Contributor

moe-ad commented Aug 8, 2025

@PProfizi nice approach. I didn't even know an action exist for downloading artifacts from other workflows. I made some suggestions, especially wrt the need for the closed event to be present.
I still have a concern: I think this shouldn't need to be on main before we can confirm that it works because reusable workflows are picked up from the current branch, the reason it currently doesn't get triggered might be because we run docs.yml from ci.yml, and it may not be considered valid for the workflow_run trigger. I may be wrong.

According to the doc you can trigger up to 3 workflows in a sequence this way

Hi @PProfizi, I just saw the section in the docs where it was stated that the workflow has to be on the default branch for this to work.. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD Related to CI/CD deploy-pr-doc For deploying a PR's documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载