Skip to content

ZPascal/check-changed-files-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

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Action: Check Changed Files

This GitHub Action checks for changed files in a Git repository and validates them against a list of allowed files and folders. It is useful for enforcing file or folder boundaries in pull requests or CI/CD pipelines.

Features

  • Checks for changed files in a Git repository and validates them against a list of allowed files and folders
  • Define a custom location of the Git repository
  • Supports checking all files and folders in the directory
  • The functionality is implemented in Python using the pygit2 library and fully tested by unit tests
  • The action can be used in GitHub Enterprise environments

Inputs

Name Description Required Default
checked_location Enter the location of the files, separated by ;. Example: src/;docs/test.txt;tests/test* true
git_location Path to the Git repository. false (current working directory)
check_all_files Enables the check of all defined files and folders in the directory. false false
github_user_token Define the used GitHub server user token for Github.com. false ""

Usage

- name: Check changed files
  uses: ZPascal/check-changed-files-action@v1
  with:
    checked_location: 'src/;docs/README.md'
    git_location: './'
    check_all_files: 'true'

Example Workflow

name: Check Changed Files

on:
  pull_request:
    paths:
      - 'src/**'
      - 'docs/**'

jobs:
  check-changes:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Check changed files
        id: test-changed-files
        uses: ZPascal/check-changed-files-action@v1
        with:
          checked_location: 'src/;docs/README.md'
          git_location: './'
          check_all_files: 'true'

      - name: Test
        if: steps.test-changed-files.outputs.files_changed == 'true'
        run: |
          echo "Files changed: ${{ steps.test-changed-files.outputs.files_changed }}"

Output

  • Logs info about changed files that are allowed or not allowed.
  • Returns true/ false and reports if changed files are detected.

Output table

Name Description
files_changed Returns true if changed files are detected and false by default.

Requirements


License

The check-changed-files-action is licensed under the Apache 2.0.

About

GitHub check changed files action

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages