Skip to content

andstor/file-existence-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

31a5027 · Jan 28, 2024

History

38 Commits
Jan 28, 2024
Jan 26, 2024
Oct 24, 2022
Feb 25, 2022
Feb 25, 2022
Feb 25, 2022
Feb 25, 2022
Feb 25, 2022
Feb 28, 2020
Feb 25, 2022
Feb 28, 2020
Jan 28, 2024
Jan 24, 2024
Jan 28, 2024
Jan 28, 2024
Feb 25, 2022

Repository files navigation

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.