Skip to content

Commit

Permalink
Use composite action for issue creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mre committed May 30, 2022
1 parent 76ab977 commit 37eb346
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ jobs:
- uses: actions/checkout@v3

- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
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/[email protected]
with:
createIssue: false
```
### Alternative approach:
Expand Down
26 changes: 23 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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"
Expand Down

0 comments on commit 37eb346

Please sign in to comment.