Skip to content

Comments

fix: make docs workflow deploy step conditional on GitHub Pages being enabled#81

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-python-docs-workflow
Open

fix: make docs workflow deploy step conditional on GitHub Pages being enabled#81
Copilot wants to merge 2 commits intomainfrom
copilot/fix-python-docs-workflow

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

Summary

The python-docs.yml workflow was failing on the deploy to GitHub Pages job with a 404 because GitHub Pages is not enabled in this template repository. The build docs job succeeded; only deployment was broken.

Changes to .github/workflows/python-docs.yml:

  • Added outputs block to build job exposing pages-enabled
  • Added Check GitHub Pages status step (post-artifact-upload) that hits the GitHub API and sets enabled=true/false — emits a workflow notice when Pages is not configured
  • Added if: needs.build.outputs.pages-enabled == 'true' guard to the deploy job so it skips gracefully instead of failing when Pages is not set up

When Pages is enabled in repo settings, the deploy job runs as before. When it isn't (e.g. in a fresh clone of this template), the workflow passes with a skipped deploy and an informational notice.

Testing

  • Not run (why?)
  • uv run poe check
  • Other: Reviewed CI logs from failed run #22202032657; fix is purely in the workflow YAML — no Python code changed. CodeQL scan returned 0 alerts.

Checklist

  • Linked issue or task reference
  • Added/updated tests where relevant
  • Updated docs/README if needed
  • No secrets or sensitive data added
  • Considered backward compatibility and deployment impact

Additional context

Original prompt

This section details on the original issue you should resolve

<issue_title>python-docs workflow failing</issue_title>
<issue_description>## Problem

The docs workflow (python-docs.yml) is failing.

Evidence

Failed action run: https://github.com/pmalarme/python-agent-template/actions/runs/22202032657

Investigation

  • Check the action run logs for the specific error
  • Verify Sphinx dependencies are installing correctly
  • Check if the docs generation script (scripts/generate_docs.py) has issues
  • Verify the docs-install step succeeds before the build step

Related

  • .github/workflows/python-docs.yml — docs workflow
  • scripts/generate_docs.py — docs generation script</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

… enabled

Co-authored-by: pmalarme <686568+pmalarme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing docs workflow in python-docs.yml fix: make docs workflow deploy step conditional on GitHub Pages being enabled Feb 19, 2026
Copilot AI requested a review from pmalarme February 19, 2026 22:12
@pmalarme pmalarme marked this pull request as ready for review February 19, 2026 22:15
Copilot AI review requested due to automatic review settings February 19, 2026 22:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the python-docs.yml workflow which was failing because GitHub Pages is not enabled in the template repository. The fix adds a pre-deployment check to detect if GitHub Pages is configured and gracefully skips deployment when it's not available, while still building the documentation successfully.

Changes:

  • Added GitHub Pages status check using the GitHub API to detect if Pages is enabled
  • Made the deploy job conditional based on the Pages availability check
  • Added informational notice when Pages is not configured instead of failing

Comment on lines +55 to +64
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/pages")
if [ "${STATUS}" = "200" ]; then
echo "enabled=true" >> "${GITHUB_OUTPUT}"
else
echo "enabled=false" >> "${GITHUB_OUTPUT}"
echo "::notice::GitHub Pages is not configured for this repository. Skipping deployment."
fi
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The STATUS variable extracted from curl output is written to GITHUB_OUTPUT without validation. According to the repository's security practices (see .github/workflows/python-release.yml:66 and .github/workflows/monorepo-release.yml:44), extracted values should be validated with regex patterns before writing to GITHUB_OUTPUT to prevent newline injection attacks.

The HTTP status code should be validated to ensure it contains only digits before being used in the conditional. While the current code writes "enabled=true" or "enabled=false" (which are safe), the STATUS variable itself should still be validated as a defense-in-depth measure.

Suggested validation:

  • Add a check like: if [[ ! "$STATUS" =~ ^[0-9]+$ ]]; then echo "::error::Invalid HTTP status received"; exit 1; fi

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

python-docs workflow failing

2 participants