Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.58 KB

README.md

File metadata and controls

46 lines (34 loc) · 1.58 KB

Match against glob action

This action tests whether filenames match against provided glob patterns. Useful to run another steps only if needed files were changed. Similar to GitLab changes feature which is available for a single job in a workflow. Uses minimatch internally.

Inputs

  • Required filenames: Filenames split by comma. E.g. src/index.js,package.json,./tests/index.test.js
  • Required patterns: Glob patterns as a YAML list. E.g. services/*-service/**/*,packages/**/*

Outputs

  • match: 'true' if at least one file matches. 'false' otherwise
  • files: Lists all files matching the patterns

Example usages

Get files changed in pull request

- uses: octokit/[email protected]
  id: get_files
  with:
    route: GET /repos/{owner}/{repo}/pulls/{pull_number}/files
    owner: meshokteam
    repo: meshok
    pull_number: ${{ github.event.pull_request.number }} 
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: kurnev/match-against-glob-action@v1
  id: match
  with:
    filenames: ${{ join(fromJson(steps.get_files.outputs.data).*.filename) }}
    patterns: 'services/nuxt/**/*,packages/shared/**/*'
- name: Run unit tests
  if: ${{ steps.match.outputs.match == 'true' }}
  uses: ./.github/actions/unit-tests/
  ...

Conventional Changelog Action is MIT licensed.

Collaboration

If you have questions or issues, please open an issue!