File: linkcheck.yml

package info (click to toggle)
cloud-init 25.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,412 kB
  • sloc: python: 135,894; sh: 3,883; makefile: 141; javascript: 30; xml: 22
file content (39 lines) | stat: -rw-r--r-- 1,131 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: scheduled-linkcheck
on:
  schedule:
    - cron: '3 14 * * *'
concurrency:
  group: 'ci-${{ github.workflow }}-${{ github.ref }}'
  cancel-in-progress: true

jobs:
  linkcheck:
    runs-on: ubuntu-24.04
    continue-on-error: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.failOnError == 'true') }}

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: "Install Python 3.10"
        uses: actions/setup-python@v5
        with:
          python-version: '3.10.8'

      - name: Install tox
        run: pip install tox

      - name: Run Sphinx linkcheck
        run: tox -e linkcheck | tee output.txt

      - name: Check for broken links below threshold
        run: |
          broken_count=$(grep -c "broken" output.txt)
          if [[ $broken_count -ge 5 ]]; then
            echo "Too many broken links detected: $broken_count"
            broken_matches=$(grep "broken" output.txt)
            echo "Broken links \n$broken_matches"
            exit 1
          else
            echo "Number of broken links is below threshold: $broken_count"
          fi