DEV Community

Dayzen
Dayzen

Posted on

Validate changed files

My Workflow

This Action is used to validate at every commit or pull request.

If you want to check to validate changed files on pushed at the master or on the pull request.

just add it in GitHub action steps like below.

Submission Category: Maintainer Must-Haves

Yaml File or Link to Code

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

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm ci
      - uses: syeutyu/validate-changed-files@v1
        with:
          file-names: '["package.json", "READMD.md"]'
          github-token: {{ Token }}

Additional Resources / Info

Behind history

When I developed the custom service sdk of npm package
Sometimes I missing update package.json version

Then I merged after

umm...? why the sdk version is not changed?
Ahh... I missed upgrade version :(

So I created this GitHub action.

Describe of the repository

When you use a versioning system or package.

Some commit or pull request must need to include important file. (ex package.json or md file)

If you write not include file and after deployed? That's a very tiring situation.

So I want to prevent the above situation therefore just created this repo.

How to use

Just simple like below that.

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

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm ci
      - uses: ./
        with:
          file-names: '["package.json", "READMD.md"]'
          github-token: {{ Token }}

The current Github action doesn't yet support an array type of input.

So I used some trick.

Just enclose an array string in quotation marks.

Top comments (0)