Skip to content
git-pull-request

GitHub Action

Ensure Files Changed

v4.1.1 Latest version

Ensure Files Changed

git-pull-request

Ensure Files Changed

Ensures files specified were changed in a PR, or can be used to ensure files were not changed

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Ensure Files Changed

uses: danieljimeneznz/ensure-files-changed@v4.1.1

Learn more about this action in danieljimeneznz/ensure-files-changed

Choose a version

Ensure Files Changed

This action ensures that pull requests contain changes to the files listed in the require-change-file-patterns array specified, it will fail if these files were not changed or if files were changed that exist in the prevent-modification-file-patterns array.

Inputs

  • require-changes-to: A list of files (or glob patterns) that represent the files that should be modified by a PR.
  • prevent-changes-to: A list of files (or glob patterns) that represent the files that should not be modified by a PR.
  • token: The GitHub token used to create an authenticated client.

Example

name: 'build-test'
on:
  pull_request:
  push:
    branches:
      - "master"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm ci
      - uses: danieljimeneznz/ensure-files-changed@v4.1.0
        with:
          require-changes-to: |
            package.json
            *.md
          prevent-changes-to: |
            LICENSE.md
          token: ${{ secrets.GITHUB_TOKEN }}

Credit to syeutyu/validate-changed-files for providing the base code