Skip to content

Commit

Permalink
Merge pull request #48 from gkarthiks/fix/nil-file
Browse files Browse the repository at this point in the history
fix: comments on issue for na file
  • Loading branch information
gkarthiks authored May 30, 2021
2 parents 9a2dd8a + eea1a0b commit 0f01da0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 0.2.1
* Errors in the action message if the words for restrictions are not defined and comment the same in the issue.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
check-latest: true
- name: NIL Reporter
uses: gkarthiks/nil-issue-reporter@0.2.0
uses: gkarthiks/nil-issue-reporter@0.2.1
id: parseissue
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -45,3 +41,6 @@ This can be customized by changing it in the workflow YML file. For example, if
* Auto validate for edit on the issue body
* Extend for issue comments
* Extend for Pull Requests

## :warning: Important Note
As of now, this GitHub action is looking for a repo owner's defined words for restricting the non-inclusive language. Once the [Inclusive Naming](https://inclusivenaming.org) defines machine-parsable words for restriction, it will be used rather depending on the repo owner's list.
19 changes: 12 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@ try {

// Create RegEx for parsing the data and comparing the nil
var nilWordArray = commaSeperatedStrToArray(nilFileData);
var regEx = new RegExp(nilWordArray.join('|'), 'gi');
if (nilWordArray.length > 0) {
var regEx = new RegExp(nilWordArray.join('|'), 'gi');

core.info("Issue number: "+issueNumber)
core.info("Issue title: "+issueTitle)

validateAndComment(issueTitle, regEx, issueAuthor, ISSUE_TITLE_CTX, labelArray, githubToken, eventName);
validateAndComment(issueContext, regEx, issueAuthor, ISSUE_DESC_CTX, labelArray, githubToken, eventName);
core.info("Issue number: "+issueNumber)
core.info("Issue title: "+issueTitle)

validateAndComment(issueTitle, regEx, issueAuthor, ISSUE_TITLE_CTX, labelArray, githubToken, eventName);
validateAndComment(issueContext, regEx, issueAuthor, ISSUE_DESC_CTX, labelArray, githubToken, eventName);
} else {
core.setFailed("Non Inclusive word list to restrict is not defined yet. Please define the words to be resricted.");
commentToIssue("The non-inclusive word list is not defined. Please ask your admin to add the list of words to restrict and then comment `/validate`.", labelArray, githubToken);
}
}

} catch (error) {
core.setFailed(error.message);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nil-issue-reporter",
"version": "0.2.0",
"version": "0.2.1",
"description": "Non-Inclusive Language(nil) issue reporter parses the issue content and write comment to the author on the issue.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 0f01da0

Please sign in to comment.