Skip to content

Adding rerun option to workflows #84428

Adding rerun option to workflows

Adding rerun option to workflows #84428

Workflow file for this run

# Sphinx docs check
# -----------------
#
# There are 2 main reasons for having this dedicated Sphinx docs check in
# addition to the Read the Docs (RTD) builder:
#
# 1. This action is set up to fail on Sphinx warnings, whereas RTD's will show
# a passing sign for warnings, and only fail for errors. So this is a stricter
# check.
#
# 2. When this action detects warnings, it produces GitHub annotations on the
# Files Changed tab in the pull request. Such annotations can be convenient for
# developers/code reviewers (e.g., the same way CodeCov and CodeFactor
# annotate).
# -----------------
name: "Documentation check"
on:
merge_group:
types:
- checks_requested
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
# Scheduled trigger on Monday at 2:47am UTC
schedule:
- cron: "47 2 * * 1"
workflow_call:
permissions: write-all
jobs:
get_branch:
runs-on: ubuntu-24.04
outputs:
run_sphinx: ${{ steps.get_pr_branch.outputs.run_sphinx }}
steps:
- name: Get PR branch name
id: get_pr_branch
run: |
BRANCH_NAME="${{ github.head_ref}}"
TARGET_NAME="${{ github.base_ref}}"
echo "branch is $BRANCH_NAME"
echo "target is $TARGET_NAME"
if [[ "$BRANCH_NAME" =~ v[0-9]+\.[0-9]+\.[0-9]+-docs$ ]]; then
echo "run_sphinx=true" >> $GITHUB_OUTPUT
elif [ "${{github.event.pull_request.draft}}" == false ]; then
echo "run_sphinx=true" >> $GITHUB_OUTPUT
elif [[ "$TARGET_NAME" =~ v[0-9]+\.[0-9]+\.[0-9]+-docs$ ]]; then
echo "run_sphinx=true" >> $GITHUB_OUTPUT
else
echo "run_sphinx=false" >> $GITHUB_OUTPUT
fi
determine_runner:
if: needs.get_branch.outputs.run_sphinx == 'true'
needs: get_branch
name: Determine runner type to use
uses: ./.github/workflows/determine-workflow-runner.yml
with:
default_runner: ubuntu-24.04
force_large_runner: ${{ github.event_name == 'merge_group' }}
sphinx:
if: needs.get_branch.outputs.run_sphinx == 'true'
needs: [determine_runner, get_branch]
runs-on: ${{ needs.determine_runner.outputs.runner_group }}
steps:
- uses: actions/checkout@v4
- uses: PennyLaneAI/sphinx-action@master
with:
docs-folder: "doc/"
pre-build-command: >
apt install -y graphviz
&& pip3 install -e '.[docs]'
&& pip3 install .
&& pip3 install openfermionpyscf
&& pip3 install aiohttp fsspec h5py
build-command: "sphinx-build -b html . _build -W --keep-going"
- name: Freeze dependencies
shell: bash
run: |
pip freeze | grep -v 'file:///' > doc.txt
cat doc.txt
- name: Upload frozen requirements
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
with:
name: frozen-doc
path: doc.txt
upload-stable-deps:
if: github.event_name == 'schedule'
needs:
- determine_runner
- sphinx
uses: ./.github/workflows/check_in_artifact.yml
with:
artifact_name_pattern: "frozen-doc"
artifact_save_path: ".github/stable/"
merge_multiple: true
pull_request_head_branch_name: bot/stable-deps-update
commit_message_description: Frozen Doc Dependencies Update
pull_request_title: Update stable dependency files
pull_request_body: |
Automatic update of stable requirement files to snapshot valid python environments.