aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/lintdocurls.yml
blob: 224953f1dbb288b47e8135aacea588ad4d5cdee7 (plain) (blame)
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
40
41
42
name: lintdoc-urls
on:
  schedule:
    - cron: '22 22 * * 5'
  workflow_dispatch:

permissions: {}

jobs:
  check-unreachable-urls:
    runs-on: ubuntu-latest
    permissions:
      issues: write
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v7.0.1
        with:
          fetch-depth: 0
          persist-credentials: false

      - name: Set up git config
        run: |
          git config --global user.name 'marvim'
          git config --global user.email 'marvim@users.noreply.github.com'

      - uses: ./.github/actions/setup

      - name: Check for unreachable URLs
        id: unreachable-urls
        env:
          run_url: https://github.com/neovim/neovim/actions/runs/${{ github.run_id }}
        run: |
          OUT_FILE=$(mktemp)
          make lintdocurls 2>&1 | sed -n '/invalid URLs/,/^}/p' > $OUT_FILE
          if [ -n $OUT_FILE -a -s $OUT_FILE ]; then
            # wrap output in a code block
            sed -i -e '1i```' -e '$a```' $OUT_FILE
            echo "Automatically generated on $(date) from $run_url" >> $OUT_FILE
            gh issue reopen 36597
            gh issue edit 36597 --body-file $OUT_FILE
          fi