Skip to content

Commit

Permalink
Merge pull request #5 from 0xCaso/master
Browse files Browse the repository at this point in the history
Add strict mode
  • Loading branch information
Noc2 authored Mar 20, 2023
2 parents 8ae6013 + 0b227a2 commit e871dea
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ steps:
uses: w3f/parse-milestone-delivery-action@master
with:
path: <path to the file>
strict: 'false' # optional, default is true
- name: Echo outputs
run: echo ${{ steps.grant_parser.outputs.team_name }}
```
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
path:
description: 'File path'
required: true
strict:
description: 'Strict mode: fails instead of warning'
required: false
default: 'true'
outputs:
application_document:
description: 'Link to application PR'
Expand Down
7 changes: 6 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2825,6 +2825,7 @@ const { promises: fs } = __nccwpck_require__(147)

const main = async () => {
const path = core.getInput('path')
const strict = core.getInput('strict')
const content = await fs.readFile(path, 'utf8')

const regexList = [
Expand Down Expand Up @@ -2879,7 +2880,11 @@ const main = async () => {

if (errors.length > 0) {
const error_string = `Match not found for: ${errors.join(', ')}`
core.setFailed(error_string)
if (strict !== 'true') {
core.warning(error_string)
} else {
core.setFailed(error_string)
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { promises: fs } = require('fs')

const main = async () => {
const path = core.getInput('path')
const strict = core.getInput('strict')
const content = await fs.readFile(path, 'utf8')

const regexList = [
Expand Down Expand Up @@ -59,7 +60,11 @@ const main = async () => {

if (errors.length > 0) {
const error_string = `Match not found for: ${errors.join(', ')}`
core.setFailed(error_string)
if (strict !== 'true') {
core.warning(error_string)
} else {
core.setFailed(error_string)
}
}
}

Expand Down

0 comments on commit e871dea

Please sign in to comment.