Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/d3ward/toolz
Browse files Browse the repository at this point in the history
  • Loading branch information
d3ward committed Apr 7, 2024
2 parents 64d54ec + e6d42a3 commit 75eea29
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 17 deletions.
16 changes: 11 additions & 5 deletions .github/ISSUE_TEMPLATE/bug-failed-test-issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,25 @@ assignees: d3ward

---

<!--
Thank you for reporting an issue. To help me process your issue effectively, please fill out each section below. Fields marked with ** are required. For fields not applicable to your issue, please write 'N/A'.
<!--
Thank you for taking the time to report an issue. To help us process your issue effectively, please fill out each section below. Fields marked with ** are required. For fields not applicable to your issue, please write 'N/A'.
Before submitting, please:
- Check if a similar issue has already been reported.
- Ensure that your issue is related to a bug or a failed test, not a question or discussion. For general questions or support, use a blank issue
-->

### Context

**Browser**:
**OS**:
**Adblock Solution**(if any):

**Operating System**:

**Adblock Solution**:

**Description of Issue**:
<!-- Please provide a clear and concise description of what the issue is, including steps to reproduce if applicable. -->


**Screenshots:**
<!-- If applicable, add screenshots to help explain your issue. -->
[Attach screenshots here if applicable]
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/issue-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Issue Template Checks

on:
issues:
types: [opened, labeled, edited]

jobs:
check-required-fields:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Comment on Issues Missing Required Fields
uses: actions/github-script@v6
with:
script: |
const issue = context.payload.issue;
const issueLabels = issue.labels.map(label => label.name);
const hasRelevantLabel = issueLabels.includes('failed-test') || issueLabels.includes('verified-test');
// Proceed only if the issue has a relevant label
if (!hasRelevantLabel) {
console.log("Issue does not have relevant labels. Skipping.");
return;
}
const requiredFields = [
"Browser:",
"OS:",
"Adblock Solution",
"Description of Issue:",
"Test Result:",
];
// Helper function to check if a required field is actually filled
const isFieldMissing = (field) => {
// Regex to find the field and any subsequent text
const fieldRegex = new RegExp(`${field}\\s*:\\s*(.+)`);
const match = issue.body.match(fieldRegex);
// Check if the field is present and has content after the colon
return !match || match[1].trim().length === 0;
};
// Find all missing fields
const missingFields = requiredFields.filter(isFieldMissing);
// If there are missing fields, post a comment
if (missingFields.length > 0) {
const commentBody = `Hello @${issue.user.login}, it looks like your issue is missing some required information: \n- ${missingFields.join("\n- ")}\nPlease update your issue to include this information.`;
await github.rest.issues.createComment({
issue_number: issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
} else {
console.log("Issue contains all required fields.");
}
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75eea29

Please sign in to comment.