GitHub Action to match lines against a matcher
The following example workflow step will check for file: foo/bar
against a matcher
- name: Match Lines
uses: paypay/match-lines-action
with:
target_file: 'foo/bar'
matcher: |
app1:1\.[0-4]\.0
app2:1\.0\.0
...
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.company1:app1:1.0.0=compileClasspath,runtimeClasspath
com.company1:app1:1.1.0=compileClasspath,runtimeClasspath
com.company1:app2:1.0.0=compileClasspath,runtimeClasspath
com.company2:app3:1.0.0=compileClasspath,runtimeClasspath
...
The following input variables options can/must be configured:
Input variable | Necessity | Description | Default |
---|---|---|---|
target_file |
Required | File to be checked. | |
matcher |
Required | Multiline with regular expression. | |
allow_failure |
Optional | Makes the Action fail on matching lines. | false |
match_count
: Count of matched lines.
First, you'll need to have a reasonably modern version of
node
handy. This won't work with versions older than 9, for instance.
Install the dependencies
$ npm install
Build the typescript and package it for distribution
$ npm run build && npm run package
Run the tests ✔️
$ npm test
PASS ./index.test.js
✓ throws invalid number (3ms)
✓ wait 500 ms (504ms)
✓ test runs (95ms)
...
Actions are run from GitHub repos so we will checkin the packed dist folder.
Then run ncc and push the results:
$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1