From e36a968522a6c6ca74209e6d12d6df329c5fab6e Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 13:29:14 +0200 Subject: [PATCH] Create issue when links are broken. Also add workflow_dispatch to be able to trigger workflow nanually. Decrease frequency of cron scheduler to once a month. Add date to the title of the issue. --- ...markdown-link-check.yml => link-check.yml} | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) rename .github/workflows/{markdown-link-check.yml => link-check.yml} (55%) diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/link-check.yml similarity index 55% rename from .github/workflows/markdown-link-check.yml rename to .github/workflows/link-check.yml index 6322bb7f..4f6292a5 100644 --- a/.github/workflows/markdown-link-check.yml +++ b/.github/workflows/link-check.yml @@ -1,6 +1,7 @@ -name: markdown-link-check +name: link-check on: + workflow_dispatch: push: branches: - main @@ -8,7 +9,11 @@ on: branches: - main schedule: - - cron: '0 0 * * 0' # every Sunday at 00:00 + - cron: '0 0 1 * *' # first day of every month at midnight + +permissions: + contents: read + issues: write jobs: linkChecker: @@ -19,15 +24,15 @@ jobs: - name: Link Checker id: lychee uses: lycheeverse/lychee-action@v1 - with: - # fail action if there are broken links - fail: true + + - name: Set Issue Title + id: set_title + run: echo "ISSUE_TITLE=Link Checker Report - $(date '+%Y-%m-%d')" >> $GITHUB_ENV - name: Create Issue From File - # create issues only when triggered by schedule - if: github.event_name == 'schedule' && env.lychee_exit_code != 0 + if: env.lychee_exit_code != 0 uses: peter-evans/create-issue-from-file@v5 with: - title: Link Checker Report + title: ${{ env.ISSUE_TITLE }} content-filepath: ./lychee/out.md labels: report, automated issue