Code Monkey home page Code Monkey logo

file-existence-action's Introduction

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
working dir Optional Uses the github working directory. 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
    defaults:
      run:
        working-directory: ./.github
    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, .github/dependabot.yml"

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

      - name: Check file existence with working dir
        id: check_files_working_dir
        uses: andstor/file-existence-action@v3
        with:
          files: "dependabot.yml"
          use working dir: true
      - name: File exists
        if: steps.check_files_working_dir.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.

file-existence-action's People

Contributors

andstor avatar daschtour avatar hbiede avatar joergi avatar khitrenovich avatar raminqaf avatar victorbnl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.