This is a GitHub Action to check if a given file or files exist in the repository. It can be used conditionally for running workflow steps based on file existence.
The following example workflow step will check if the following files exist: package.json
, index.ts
, README.md
, foo
*.txt
- name: 'Check File Existence'
uses: thebinaryfelix/check-file-existence-action@v1
with:
files: 'package.json, index.ts, README.md, *.txt'
The following input variables options can be configured:
Input variable | Necessity | Description | Default |
---|---|---|---|
files |
Required | Comma separated string with paths to files and directories to check for existence. Supports glob paterns. | |
ignore_case |
Optional | Ignore if a file name has upper or lower cases. | true |
follow_symlinks |
Optional | Indicates whether to follow symbolic links. | true |
exists
: Outputstrue
if the file(s) exists, otherwisefalse
.
name: 'Check File Existence'
on: [push, pull_request]
jobs:
check_file_existence:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v1
- name: Check file existence
id: check_files
uses: thebinaryfelix/check-file-existence-action@v1
with:
files: 'package.json, LICENSE, README.md'
- name: Files exist
if: steps.check_files.outputs.exists == 'true'
# Only runs if all of the files exist
run: echo "All files exist!"
Feel free to fork this repository and open a Pull Request to:
- Include a feature
- Bugfixes
- Update documentation
To do so, follow the steps below:
Fork this repository and create a branch to work on.
Before openning a pull request, make sure you included the changelog fragments
.
To add a changelog fragment, execute npx news-fragments create [type]
and replace [type]
for one of the following:
- feature
- bugfix
- doc
- removal
- misc
Include a clear message of all the changes you are including in your pull request.
When openning your pull request, make sure to include all details of what you did and the motivation behind it.
Copyright © 2022 Mateus Félix
check-file-existence-action is licensed under the MIT License.