From 37eb34648eee10c286033e8167d67f52854f00fc Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 31 May 2022 00:36:48 +0200 Subject: [PATCH] Use composite action for issue creation --- README.md | 17 +++++++++-------- action.yml | 26 +++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4dc5e9a..f827a89 100644 --- a/README.md +++ b/README.md @@ -32,18 +32,19 @@ jobs: - uses: actions/checkout@v3 - name: Link Checker - id: lychee uses: lycheeverse/lychee-action@v1.5.0 env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Create Issue From File - if: steps.lychee.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@v3 - with: - title: Link Checker Report - content-filepath: ./lychee/out.md - labels: report, automated issue +``` + +Issue creation can optionally be disabled + +```yaml +- name: Link Checker + uses: lycheeverse/lychee-action@v1.5.0 + with: + createIssue: false ``` ### Alternative approach: diff --git a/action.yml b/action.yml index 36791b1..b4df553 100644 --- a/action.yml +++ b/action.yml @@ -25,17 +25,31 @@ inputs: description: "use custom version of lychee link checker" default: 0.10.0 required: false + createIssue: + description: "create Github issue if link check fails" + default: true + required: false + issueTitle: + description: "title of Github issue which will be created if link check fails" + default: Link Checker Report + required: false + issueLabels: + description: "attach labels to Github issue" + default: links, report, automated issue + required: false + + runs: using: "composite" steps: - - name: install lychee - run: | + - run: | curl -LO 'https://github.com/lycheeverse/lychee/releases/download/v${{ inputs.LYCHEEVERSION }}/lychee-v${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz' tar -xvzf lychee-v${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz chmod 755 lychee mv lychee /usr/local/bin/lychee shell: bash - - run: ${{ github.action_path }}/entrypoint.sh + - id: lychee + run: ${{ github.action_path }}/entrypoint.sh env: #https://github.com/actions/runner/issues/665 INPUT_GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} @@ -45,6 +59,12 @@ runs: INPUT_FAIL: ${{ inputs.FAIL }} INPUT_JOBSUMMARY: ${{ inputs.JOBSUMMARY }} shell: bash + - if: inputs.CREATEISSUE && steps.lychee.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v4 + with: + title: ${{ inputs.ISSUETITLE }} + labels: ${{ inputs.ISSUELABELS }} + content-filepath: ${{ inputs.OUTPUT }} branding: icon: "external-link"