Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ jobs:
'./**/*.html'
'./**/*.rst'

- name: test working directory functionality
uses: ./
with:
workingDirectory: fixtures/subdir
args: --dump-inputs '*'
output: ${{ github.workspace }}/working_dir_inputs.txt

- name: test working directory output
run: |
line_count=$(wc -l < ${{ github.workspace }}/working_dir_inputs.txt)
if ! grep -q "test-working-dir.md" ${{ github.workspace }}/working_dir_inputs.txt || [ "$line_count" -ne 2 ]; then
echo "Working directory test failed. Output:"
cat ${{ github.workspace }}/working_dir_inputs.txt
exit 1
fi

- name: test custom output relative path - creation
uses: ./
with:
Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,18 @@ lychee arguments can be passed to the action via the `args` parameter.

On top of that, the action also supports some additional arguments.

| Argument | Examples | Description |
| ------------- | ----------------------- | ------------------------------------------------------------------------------- |
| args | `--cache`, `--insecure` | See [lychee's documentation][lychee-args] for all arguments and values |
| debug | `false` | Enable debug output in action (set -x). Helpful for troubleshooting |
| fail | `false` | Fail workflow run on error (i.e. when [lychee exit code][lychee-exit] is not 0) |
| failIfEmpty | `false` | Fail entire pipeline if no links were found |
| format | `markdown`, `json` | Summary output format |
| jobSummary | `false` | Write GitHub job summary (on Markdown output only) |
| lycheeVersion | `v0.15.0`, `nightly` | Overwrite the lychee version to be used |
| output | `lychee/results.md` | Summary output file path |
| token | `""` | Custom GitHub token to use for API calls |
| Argument | Examples | Description |
| ---------------- | ----------------------- | ------------------------------------------------------------------------------- |
| args | `--cache`, `--insecure` | See [lychee's documentation][lychee-args] for all arguments and values |
| debug | `false` | Enable debug output in action (set -x). Helpful for troubleshooting |
| fail | `false` | Fail workflow run on error (i.e. when [lychee exit code][lychee-exit] is not 0) |
| failIfEmpty | `false` | Fail entire pipeline if no links were found |
| format | `markdown`, `json` | Summary output format |
| jobSummary | `false` | Write GitHub job summary (on Markdown output only) |
| lycheeVersion | `v0.15.0`, `nightly` | Overwrite the lychee version to be used |
| output | `lychee/results.md` | Summary output file path |
| token | `""` | Custom GitHub token to use for API calls |
| workingDirectory | `.`, `path/to/subdir/` | Custom working directory to run lychee in |

See [action.yml](./action.yml) for a full list of supported arguments and their default values.

Expand All @@ -86,6 +87,8 @@ Here is how to pass the arguments.
token: ${{ secrets.CUSTOM_TOKEN }}
# Don't fail action on broken links
fail: false
# Run lychee in a different directory
workingDirectory: website/subdir
```

(If you need a token that requires permissions that aren't available in the
Expand Down Expand Up @@ -144,6 +147,8 @@ If you need more control over when caches are restored and saved, you can split
Add a `.lycheeignore` file to the root of your repository to exclude links from
getting checked. It supports regular expressions. One expression per line.

You can also put your `.lycheeignore` into a subdirectory if you set that as the `workingDirectory`.

## Fancy badge

Pro tip: You can add a little badge to your repo to show the status of your
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ inputs:
description: "Your GitHub Access Token, defaults to: {{ github.token }}"
default: ${{ github.token }}
required: false
workingDirectory:
description: "Directory to run lychee in"
default: "."
required: false

outputs:
exit_code:
Expand Down Expand Up @@ -111,6 +115,7 @@ runs:

- name: Run Lychee
id: run-lychee
working-directory: ${{ inputs.workingDirectory }}
run: ${{ github.action_path }}/entrypoint.sh
env:
# https://github.com/actions/runner/issues/665
Expand Down
1 change: 1 addition & 0 deletions fixtures/subdir/test-working-dir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Test File with [Link](https://lychee.cli.rs/)
Loading