📁 :octocat: GitHub Action to check for file existence
Find a file
2024-01-28 19:34:24 +01:00
.github Update build.yml 2024-01-28 19:20:54 +01:00
dist update worklow versions 2024-01-26 08:10:04 +01:00
src Correct input name 2022-10-25 01:33:04 +02:00
test Update dependencies 2022-02-25 18:45:56 +01:00
.eslintignore Update dependencies 2022-02-25 18:45:56 +01:00
.eslintrc.json Update dependencies 2022-02-25 18:45:56 +01:00
.gitignore Add support for glob patterns 2022-02-25 03:00:12 +01:00
.mocharc.cjs Add support for glob patterns 2022-02-25 03:00:12 +01:00
.prettierignore Initial commit 2020-02-28 15:16:10 +01:00
.prettierrc.json Update dependencies 2022-02-25 18:45:56 +01:00
action.yml Replace Node.js 16 with Node.js 20 2024-01-24 09:08:44 +01:00
LICENSE Update LICENSE 2020-02-28 21:01:14 +01:00
package-lock.json 3.0.0 2024-01-28 17:56:37 +00:00
package.json 3.0.0 2024-01-28 17:56:37 +00:00
README.md Update README.md 2024-01-28 19:34:24 +01:00
tsconfig.json Update dependencies 2022-02-25 18:45:56 +01:00

file-existence-action

GitHub Action to check for file existence

build-test

This is a GitHub Action to check for the existence of files. It can be used for conditionally running workflow steps based on file(s) existence.

Usage

The following example workflow step will check for existence of the files: package.json, LICENSE, README.md, foo bar

- name: "Check file existence"
  uses: andstor/file-existence-action@v3
  with:
    files: "package.json, LICENSE, README.md, foo, *.txt"

Options ⚙️

The following input variables options can/must 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_symbolic_links Optional Indicates whether to follow symbolic links. true
fail Optional Makes the Action fail on missing files. false

Outputs

  • files_exists: Outputs true if the file(s) exists, otherwise false.

Example

name: "File existence check"

on: [push, pull_request]

jobs:
  file_existence:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Check file existence
        id: check_files
        uses: andstor/file-existence-action@v3
        with:
          files: "package.json, LICENSE, README.md"

      - name: File exists
        if: steps.check_files.outputs.files_exists == 'true'
        # Only runs if all of the files exists
        run: echo All files exists!

License

Copyright © 2020 André Storhaug

file-existence-action is licensed under the MIT License.