Skip to content

Commit e2ac35d

Browse files
trallarddrammock
andauthored
MAINT - Workflows updates (#2174)
This PR _should_ be the last of a series of improvements to our CI: 1. We have been having intermittent failures on our `docs-check` workflow when trying to check links for `gnu` such as: ``` /home/runner/work/pydata-sphinx-theme/pydata-sphinx-theme/docs/community/topics/i18n.rst:112: WARNING: broken link: https://www.gnu.org/software/gettext/manual/gettext.html#Fuzzy-Entries (HTTPSConnectionPool(host='www.gnu.org', port=443): Max retries exceeded with url: /software/gettext/manual/gettext.html (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f6d203efb10>: Failed to establish a new connection: [Errno 101] Network is unreachable'))) ``` This PR tries to fix the timeout/retry issues. 2. Remove the RTD preview action that adds the link to the PR comment, as it has been failing despite having the correct permissions (and it seems RTD folks plan to move this to RTD directly readthedocs/readthedocs.org#11780) 3. Fixes the last trigger-related issues after changing the `coverage` workflow to `workflow_call` so we get our coverage comments again (I have a PR in my repo with this working again trallard#2) --------- Co-authored-by: Daniel McCloy <[email protected]>
1 parent cff6525 commit e2ac35d

File tree

4 files changed

+20
-26
lines changed

4 files changed

+20
-26
lines changed

.github/workflows/CI.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,16 @@ jobs:
195195
# we might want to pin the SHA once merged
196196
coverage-comment:
197197
# Important: make sure to update the SHA after making any changes to the coverage workflow
198-
uses: pydata/pydata-sphinx-theme/.github/workflows/coverage.yml@4a1e7898d6c92dade5e489684277ab4ffd0eb053
198+
# removing pin to test changes
199+
uses: ./.github/workflows/coverage.yml
199200
needs: [coverage]
200201
# ensures this runs even if the coverage step does not continue - e.g. the
201202
# default coverage action will fail at first for external PRs, this is a workaround
202203
# to ensure the comment is posted
203-
if: ${{ always() }}
204+
if: ${{ github.event.name == 'pull_request'}}
205+
with:
206+
# this is the workflow run ID of the `CI.yml` workflow
207+
workflow_run_id: ${{ github.event.workflow_run.id }}
204208
permissions:
205209
contents: write
206210
pull-requests: write

.github/workflows/coverage.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ name: Post coverage comment
22

33
on:
44
workflow_call:
5-
5+
inputs:
6+
# this is the workflow run ID of the `CI.yml` workflow
7+
workflow_run_id:
8+
required: true
9+
type: string
610
jobs:
711
test:
812
name: "Display code coverage"
913
runs-on: ubuntu-latest
10-
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
1114
permissions:
1215
pull-requests: write
1316
contents: write # needed to edit the comment vs opening multiple ones
@@ -21,7 +24,7 @@ jobs:
2124
env:
2225
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2326
REPO: ${{ github.repository }}
24-
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
27+
WORKFLOW_RUN_ID: ${{ inputs.workflow_run_id }}
2528

2629
# this needs the .coverage file so we download from the CI workflow artifacts
2730
- name: "Download coverage data 📥"
@@ -30,7 +33,7 @@ jobs:
3033
pattern: coverage-data-*
3134
merge-multiple: true
3235
github-token: ${{ secrets.GITHUB_TOKEN }}
33-
run-id: ${{ github.event.workflow_run.id }}
36+
run-id: ${{ inputs.workflow_run_id }}
3437

3538
- name: "Check downloaded files"
3639
run: ls -R
@@ -39,4 +42,4 @@ jobs:
3942
uses: py-cov-action/python-coverage-comment-action@b2eb38dd175bf053189b35f738f9207278b00925
4043
with:
4144
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
45+
GITHUB_PR_RUN_ID: ${{ inputs.workflow_run_id }}

.github/workflows/rtd-preview-link.yml

-19
This file was deleted.

docs/conf.py

+6
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ def setup(app: Sphinx) -> Dict[str, Any]:
358358
}
359359

360360

361+
# -- linkcheck options ---------------------------------------------------------
362+
361363
linkcheck_anchors_ignore = [
362364
# match any anchor that starts with a '/' since this is an invalid HTML anchor
363365
r"\/.*",
@@ -399,3 +401,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
399401
r"http://www.yahoo.com": "https://www.yahoo.com/",
400402
r"https://feature-engine.readthedocs.io/": "https://feature-engine.trainindata.com/en/latest/",
401403
}
404+
405+
# we have had issues with linkcheck timing and retries on www.gnu.org
406+
linkcheck_retries = 3
407+
linkcheck_timeout = 50

0 commit comments

Comments
 (0)