Skip to content

Commit

Permalink
Change white_listed_* to exclude_* (#73)
Browse files Browse the repository at this point in the history
* updating white listed variables to be exclude instead
* updating examples to reference master for consistency
Signed-off-by: vsoch <vsochat@stanford.edu>
  • Loading branch information
vsoch committed Jan 13, 2021
1 parent ff11a99 commit 8a60158
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
file_types: .md,.py,.rst
timeout: 5
retry_count: 3
white_listed_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
white_listed_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
white_listed_files: README.md,/github/workspace/_config.yml
exclude_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
exclude_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
exclude_files: README.md,/github/workspace/_config.yml

- name: Test UrlChecker Action with Save
uses: ./
Expand Down
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ The action aims at detecting and reporting broken links.
## How to use it?

A set of examples are included in the [examples](examples) folder. A few detailed
examples are also included below.
examples are also included below. Note that examples always reference the master branch,
however you should change them to reference a [release](https://github.com/urlstechie/urlchecker-action/releases).

### Example with Checkout

Expand All @@ -29,7 +30,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: urls-checker
uses: urlstechie/urlchecker-action@0.2.1
uses: urlstechie/urlchecker-action@master
with:
# A subfolder or path to navigate to in the present or cloned repository
subfolder: docs
Expand All @@ -47,15 +48,18 @@ jobs:
retry_count: 3
# A comma separated links to exclude during URL checks
white_listed_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
exclude_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
# A comma separated patterns to exclude during URL checks
white_listed_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
exclude_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
# choose if the force pass or not
force_pass : true
```

Note that as of version 0.2.2, references to `white_listed_*` have been changed to
`exclude_*` to be consistent with the `include_*` variables.


### Example with Custom Clone

Expand All @@ -75,7 +79,7 @@ jobs:
steps:
- name: URLs-checker
uses: urlstechie/urlchecker-action@0.2.1
uses: urlstechie/urlchecker-action@master
with:
# A project to clone. If not provided, assumes already cloned in the present working directory.
git_path: https://github.com/urlstechie/URLs-checker-test-repo
Expand All @@ -102,13 +106,13 @@ jobs:
retry_count: 3
# A comma separated links to exclude during URL checks
white_listed_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
exclude_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
# A comma separated patterns to exclude during URL checks
white_listed_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
exclude_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
# A comma separated list of file patterns (direct paths work as well) to exclude
white_listed_files: README.md,/github/workspace/_config.yml
exclude_files: README.md,/github/workspace/_config.yml
# choose if the force pass or not
force_pass : true
Expand All @@ -128,9 +132,9 @@ jobs:
| `retry_count` | <span style="color:green"> optional </span> | If a request fails, retry this number of times. Defaults to 1 |
| `save` | <span style="color:green"> optional </span> | A path to a csv file to save results to |
| `timeout` | <span style="color:green"> optional </span> | The timeout to provide to requests to wait for a response. |
| `white_listed_urls` | <span style="color:green"> optional </span> | A comma separated links to exclude during URL checks. |
| `white_listed_patterns` | <span style="color:green"> optional </span> | A comma separated patterns to exclude during URL checks. |
| `white_listed_files` | <span style="color:green"> optional </span> | Full paths to files to exclude (comma separated list). |
| `exclude_urls` | <span style="color:green"> optional </span> | A comma separated list of links. |
| `exclude_patterns` | <span style="color:green"> optional </span> | A comma separated list of patterns. |
| `exclude_files` | <span style="color:green"> optional </span> | Full paths to files to exclude (comma separated list). |
| `force_pass` | <span style="color:green"> optional </span> | Choose whether to force a pass when checks are done. |

## Demo
Expand All @@ -148,8 +152,8 @@ or inspiration. If you want to add your community, please let us know with an is

| Repository | Workflow (with permalink to YAML) | Example runs |
|-----------------------------------------------------------------------------------------------------|-----------------------------------|-------------|
| [awesome-rseng](https://github.com/rseng/awesome-rseng) | [Check URLs in PRs, whitelists docs](https://github.com/rseng/awesome-rseng/blob/5f5cb78f8392cf10aec2f3952b305ae9611029c2/.github/workflows/urlchecker.yml) | [Logs](https://github.com/rseng/awesome-rseng/actions?query=workflow%3AURLChecker) |
| [awesome-rseng](https://github.com/rseng/awesome-rseng) | [Check URLs in PRs, exclude docs](https://github.com/rseng/awesome-rseng/blob/5f5cb78f8392cf10aec2f3952b305ae9611029c2/.github/workflows/urlchecker.yml) | [Logs](https://github.com/rseng/awesome-rseng/actions?query=workflow%3AURLChecker) |
| [buildtest](https://github.com/buildtesters/buildtest) | [Check URLs in all commits](https://github.com/buildtesters/buildtest/blob/v0.9.1/.github/workflows/urlchecker.yml) | [Logs](https://github.com/HPC-buildtest/buildtest-framework/actions?query=workflow%3A%22Check+URLs%22) |
| [us-rse](https://github.com/USRSE/usrse.github.io) | [Check URLs in PRs, whitelists some URL patterns](https://github.com/USRSE/usrse.github.io/blob/abcbed5f5703e0d46edb9e8850eea8bb623e3c1c/.github/workflows/urlchecker.yml) | [Logs](https://github.com/USRSE/usrse.github.io/actions?query=workflow%3A%22Check+URLs%22) |
| [us-rse](https://github.com/USRSE/usrse.github.io) | [Check URLs in PRs, exclude some URL patterns](https://github.com/USRSE/usrse.github.io/blob/abcbed5f5703e0d46edb9e8850eea8bb623e3c1c/.github/workflows/urlchecker.yml) | [Logs](https://github.com/USRSE/usrse.github.io/actions?query=workflow%3A%22Check+URLs%22) |
| [R-hub docs](https://github.com/r-hub/docs) | [Check URLs when on PR labelling](https://github.com/r-hub/docs/blob/bc1eac71206f7cb96ca00148dcf3b46c6d25ada4/.github/workflows/pr.yml) | [Logs](https://github.com/r-hub/docs/actions?query=workflow%3ACommands) |
| [Berlin Hack & Tell](https://github.com/berlin-hack-and-tell/berlinhackandtell.rocks) | [Check URLs when on PR labelling](https://github.com/berlin-hack-and-tell/berlinhackandtell.rocks/blob/master/.github/workflows/urlchecker-pr-label.yml) | [Logs](https://github.com/berlin-hack-and-tell/berlinhackandtell.rocks/actions?query=workflow%3ACommands) |
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ inputs:
required: false
default: 5

white_listed_urls:
exclude_urls:
description: "A comma seperated links to exclude during URL checks."
required: false
default: ""

white_listed_patterns:
exclude_patterns:
description: "A comma seperated patterns to exclude during URL checks."
required: false
default: ""

white_listed_files:
exclude_files:
description: "A comma seperated list of paths or patterns to exclude during URL checks."
required: false
default: ""
Expand Down
19 changes: 9 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ if [ ! -z "${INPUT_FILE_TYPES}" ]; then
fi


# white listed urls are optional
if [ ! -z "${INPUT_WHITE_LISTED_URLS}" ]; then
COMMAND="${COMMAND} --white-listed-urls ${INPUT_WHITE_LISTED_URLS}"
# exclude (previously whitelisted) urls are optional
if [ ! -z "${INPUT_EXCLUDE_URLS}" ]; then
COMMAND="${COMMAND} --white-listed-urls ${INPUT_EXCLUDE_URLS}"
fi

# white listed patterns are optional
if [ ! -z "${INPUT_WHITE_LISTED_PATTERNS}" ]; then
COMMAND="${COMMAND} --white-listed-patterns ${INPUT_WHITE_LISTED_PATTERNS}"
# exclude (previously white listed) patterns are optional
if [ ! -z "${INPUT_EXCLUDE_PATTERNS}" ]; then
COMMAND="${COMMAND} --white-listed-patterns ${INPUT_EXCLUDE_PATTERNS}"
fi

# white listed files are optional
if [ ! -z "${INPUT_WHITE_LISTED_FILES}" ]; then
COMMAND="${COMMAND} --white-listed-files ${INPUT_WHITE_LISTED_FILES}"
# exclude (previously white listed) files are optional
if [ ! -z "${INPUT_EXCLUDE_FILES}" ]; then
COMMAND="${COMMAND} --white-listed-files ${INPUT_EXCLUDE_FILES}"
fi


Expand Down Expand Up @@ -93,4 +93,3 @@ echo "${COMMAND}"

${COMMAND}
echo $?

7 changes: 4 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

The following examples are added for your convenience. Each of these files
would be added to a .github/workflows folder to be run on some [github event](https://help.github.com/en/actions/reference/events-that-trigger-workflows).
Note that the files reference the "master" branch of the repository for consistency, however you should change this to an actual [release](https://github.com/urlstechie/urlchecker-action/releases) for your deployment.

## General

- [GitHub Checkout](urlchecker-checkout.yml): the most likely case of usage for this action is checking out the repository that the action is running for, meaning we use the active branch for the check.
- [GitHub Clone](urlchecker-clone.yml): while it's more a niche use case, you might want to clone one or more repos to check for an action run.

## White Listing
## Excluding Files and Folders

- [urlchecker-whitelist-files.yml](urlchecker-whitelist-files.yml): in this example, we have a repository where we want to check only a README.md file at the root, and importantly, skip over an entire subfolder that serves a rendered site at docs. We want to run the check whenever someone opens a pull request.
- [urlchecker-exclude-files.yml](urlchecker-exclude-files.yml): in this example, we have a repository where we want to check only a README.md file at the root, and importantly, skip over an entire subfolder that serves a rendered site at docs. We want to run the check whenever someone opens a pull request.

## Include Files

- [urlchecker-include-files.yml](urlchecker-include-files.yml): as an alternative to white listing files or patterns, you can specify an explicit file path or pattern to check. This is useful if you want to set some comma separated listing of files or patterns in another step, and then set for the action here.
- [urlchecker-include-files.yml](urlchecker-include-files.yml): as an alternative to excluding files or patterns, you can specify an explicit file path or pattern to check. This is useful if you want to set some comma separated listing of files or patterns in another step, and then set for the action here.

## Saving

Expand Down
6 changes: 3 additions & 3 deletions examples/urlchecker-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: urls-checker
uses: urlstechie/urlchecker-action@0.1.7
uses: urlstechie/urlchecker-action@master
with:
# A subfolder or path to navigate to in the present or cloned repository
subfolder: docs
Expand All @@ -27,10 +27,10 @@ jobs:
retry_count: 3

# A comma separated links to exclude during URL checks
white_listed_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
exclude_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2

# A comma separated patterns to exclude during URL checks
white_listed_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
exclude_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues

# choose if the force pass or not
force_pass : true
8 changes: 4 additions & 4 deletions examples/urlchecker-clone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

steps:
- name: URLs-checker
uses: urlstechie/urlchecker-action@0.1.7
uses: urlstechie/urlchecker-action@master
with:
# A project to clone. If not provided, assumes already cloned in the present working directory.
git_path: https://github.com/urlstechie/URLs-checker-test-repo
Expand All @@ -35,13 +35,13 @@ jobs:
retry_count: 3

# A comma separated links to exclude during URL checks
white_listed_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
exclude_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2

# A comma separated patterns to exclude during URL checks
white_listed_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
exclude_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues

# A comma separated list of file patterns (direct paths work as well) to exclude
white_listed_files: README.md,/github/workspace/_config.yml
exclude_files: README.md,/github/workspace/_config.yml

# choose if the force pass or not
force_pass : true
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v2
- name: Test GitHub Action
uses: urlstechie/urlchecker-action@0.1.7
with:
uses: urlstechie/urlchecker-action@master
with:
file_types: .md
white_listed_files: docs
exclude_files: docs
2 changes: 1 addition & 1 deletion examples/urlchecker-include-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v2
- name: Test GitHub Action
uses: urlstechie/urlchecker-action@0.1.9
uses: urlstechie/urlchecker-action@master
with:
file_types: .md
include_files: README.md
4 changes: 2 additions & 2 deletions examples/urlchecker-jekyll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
bundle check || bundle install
bundle exec jekyll build
- name: urls-checker
uses: urlstechie/urlchecker-action@0.1.7
uses: urlstechie/urlchecker-action@master
with:

# subfolder with files to test
Expand All @@ -40,7 +40,7 @@ jobs:
retry_count: 3

# A comma separated patterns to exclude during URL checks
white_listed_patterns: twitter.com,turing.ac.uk,linkedin.com
exclude_patterns: twitter.com,turing.ac.uk,linkedin.com

# choose if the force pass or not
force_pass : false
2 changes: 1 addition & 1 deletion examples/urlchecker-pr-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# Run URL checks
- name: URLs-checker
uses: urlstechie/urlchecker-action@0.2.1
uses: urlstechie/urlchecker-action@master
with:
save: "urls.csv"
# only include the changed files
Expand Down
6 changes: 3 additions & 3 deletions examples/urlchecker-save-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: urls-checker
uses: urlstechie/urlchecker-action@0.2.1
uses: urlstechie/urlchecker-action@master
with:
# A subfolder or path to navigate to in the present or cloned repository
subfolder: docs
Expand All @@ -27,10 +27,10 @@ jobs:
retry_count: 3

# A comma separated links to exclude during URL checks
white_listed_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2
exclude_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2

# A comma separated patterns to exclude during URL checks
white_listed_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues
exclude_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues

# choose if the force pass or not
force_pass : true
Expand Down

0 comments on commit 8a60158

Please sign in to comment.