generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat-630-date-picker
- Loading branch information
Showing
5 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*-lock.* | ||
.pnpm-store | ||
build | ||
coverage | ||
data | ||
dist | ||
node_modules | ||
package.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Compliance | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- reopened | ||
- unassigned | ||
|
||
jobs: | ||
check-for-linked-issue: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check for keyword and issue number | ||
id: check-for-keyword | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
// Retrieve body of context.payload and search for GitHub keywords | ||
const prBody = context.payload.pull_request.body; | ||
const prNumber = context.payload.pull_request.number; | ||
const prOwner = context.payload.pull_request.user.login; | ||
const regex = /(?<!Example:\s*)(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)\s+#(\d+)/i; | ||
const match = prBody.match(regex); | ||
let prComment; | ||
if (!match) { | ||
console.log('PR does not have a properly linked issue. Posting comment...'); | ||
prComment = `@${prOwner}, this Pull Request is not linked to a valid issue. Please provide a valid linked issue in "Related Issues" above, using the format of "Resolves #" + issue number.`; | ||
} | ||
else { | ||
let [ , keyword, linkNumber ] = match; | ||
console.log('Found a keyword: \'' + keyword + '\'. Checking for legitimate linked issue...'); | ||
try { | ||
const response = await github.rest.issues.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: linkNumber, | ||
}); | ||
console.log('Found an issue: \'#' + linkNumber + '\' in repo. Reference is a legitimate linked issue.'); | ||
} | ||
catch (error) { | ||
console.log('Couldn\'t find issue #' + linkNumber + ' in repo. Posting comment...'); | ||
prComment = `@${prOwner}, the issue number referenced above as "**${keyword} #${linkNumber}**" is not found. Please replace with a valid issue number.`; | ||
} | ||
} | ||
if (prComment) { | ||
github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: prNumber, | ||
body: prComment, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters