-
Notifications
You must be signed in to change notification settings - Fork 5k
New issues template based on sample. #1310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
d10e550
Create Sample Issue template
5an7y fce97a3
Merge pull request #1 from 5an7y/sample-based-issue-template
5an7y 841bf5e
Update sample_issue.yml
5an7y b279aaa
Action to auto generate the sample issues template
5an7y b83d9d2
Action to auto tag the codeowner.
5an7y 737e921
id fix
5an7y 9e1ed2c
Merge pull request #2 from 5an7y/sample-based-issue-template
5an7y 268a017
import requests module
5an7y 7ac40cb
Merge pull request #4 from 5an7y/sample-based-issue-template
5an7y e48795a
Correct regex expression
5an7y ba50875
Merge pull request #6 from 5an7y/sample-based-issue-template
5an7y 4c463c3
Made the query more efficient
5an7y 5d1436e
Merge pull request #8 from 5an7y/sample-based-issue-template
5an7y 12d6551
Selected path bug fix
5an7y b3eac5f
Merge pull request #10 from 5an7y/sample-based-issue-template
5an7y 69b234c
Fix selected path bug
5an7y 4525b22
Merge pull request #12 from 5an7y/sample-based-issue-template
5an7y 1cef4c5
Sort the area in the issue template
5an7y c75fc92
Merge pull request #14 from 5an7y/sample-based-issue-template
5an7y 454b597
Correct codeowner path
5an7y 668fe2d
Merge pull request #15 from 5an7y/sample-based-issue-template
5an7y 44faaa2
Correct sample issue path
5an7y 8012049
Merge pull request #16 from 5an7y/sample-based-issue-template
5an7y 9b45042
Order sample issue
5an7y cb0261e
Merge pull request #18 from 5an7y/sample-based-issue-template
5an7y 152cf49
Merge branch 'main' into main
5an7y 396d2f0
Merge branch 'main' into main
5an7y 9a897b9
Merge branch 'microsoft:main' into main
5an7y a0d6b25
Reference PR head
5an7y b45d3d6
Merge pull request #1319 from 5an7y/main
5an7y-Microsoft 73af9a1
sample-issue creates error instead of push
5an7y 28716b5
Rename 'generate' -> 'check'
5an7y 9014cc3
Merge branch 'microsoft:main' into main
5an7y c7e53ea
Merge pull request #21 from microsoft/user/5an7y/issues_based_on_samples
5an7y 2c6d1d3
Update triggers
5an7y-Microsoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,75 @@ | ||
| name: Issue with a sample | ||
| description: Report a problem you have with a specific sample. | ||
| title: '[path/to/sample]: ' | ||
| body: | ||
| - type: dropdown | ||
| id: sample_area | ||
| attributes: | ||
| label: Which is the area where the sample lives? | ||
| description: Select the area where you're experiencing the problem. | ||
| options: | ||
| - /TrEE/ | ||
| - /audio/ | ||
| - /avstream/ | ||
| - /bluetooth/ | ||
| - /filesys/cdfs/ | ||
| - /filesys/fastfat/ | ||
| - /filesys/miniFilter/ | ||
| - /general/DCHU/ | ||
| - /general/PLX9x5x/ | ||
| - /general/SimpleMediaSource/ | ||
| - /general/SystemDma/ | ||
| - /general/cancel/ | ||
| - /general/echo/ | ||
| - /general/event/ | ||
| - /general/ioctl/ | ||
| - /general/pcidrv/ | ||
| - /general/perfcounters/ | ||
| - /general/registry/ | ||
| - /general/toaster/ | ||
| - /general/tracing/ | ||
| - /gnss/ | ||
| - /gpio/ | ||
| - /hid/ | ||
| - /input/ | ||
| - /network/config/ | ||
| - /network/modem/ | ||
| - /network/ndis/ | ||
| - /network/radio/ | ||
| - /network/trans/ | ||
| - /network/wlan/ | ||
| - /network/wsk/ | ||
| - /network/wwan/ | ||
| - /nfc/ | ||
| - /pofx/PEP/ | ||
| - /pofx/UMDF2/ | ||
| - /pofx/WDF/ | ||
| - /pos/ | ||
| - /powerlimit/ | ||
| - /print/ | ||
| - /prm/ | ||
| - /sd/ | ||
| - /security/ | ||
| - /sensors/ | ||
| - /serial/ | ||
| - /setup/ | ||
| - /simbatt/ | ||
| - /smartcrd/ | ||
| - /spb/ | ||
| - /storage/ | ||
| - /thermal/ | ||
| - /tools/ | ||
| - /usb/ | ||
| - /video/ | ||
| - /wia/ | ||
| - /wmi/wmiacpi/ | ||
| - /wmi/wmisamp/ | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: description | ||
| attributes: | ||
| label: Describe the issue | ||
| description: Provide a clear and concise description of what the issue is. | ||
| validations: | ||
| required: true |
This file contains hidden or 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,72 @@ | ||
| import yaml | ||
| import os | ||
|
|
||
| # Read the CODEOWNERS file | ||
| codeowners_path = os.path.join(os.path.dirname(__file__), "..", "CODEOWNERS") | ||
| with open(codeowners_path, "r") as file: | ||
| lines = file.readlines() | ||
|
|
||
| # Parse the CODEOWNERS file to extract areas and their paths | ||
| areas = [] | ||
| sample_section_found = False | ||
|
|
||
| for line in lines: | ||
| line = line.strip() | ||
| if line.startswith("# Samples"): | ||
| sample_section_found = True | ||
| continue | ||
|
|
||
| if sample_section_found: | ||
| if line.startswith("#"): | ||
| continue | ||
| elif line: | ||
| path, codeowner = line.split() | ||
| if path in areas: | ||
| raise ValueError(f"Path:{path} has been found two times inside CODEOWNERS file") | ||
| areas.append(path) | ||
|
|
||
|
|
||
| # Sort the areas in lexicographical order | ||
| areas = sorted(areas) | ||
|
|
||
| # Generate the YAML structure | ||
| yaml_form = { | ||
| "name": "Issue with a sample", | ||
| "description": "Report a problem you have with a specific sample.", | ||
| "title": "[path/to/sample]: ", | ||
| "body": [] | ||
| } | ||
|
|
||
| dropdown = { | ||
| "type": "dropdown", | ||
| "id": "sample_area", | ||
| "attributes": { | ||
| "label": "Which is the area where the sample lives?", | ||
| "description": "Select the area where you're experiencing the problem.", | ||
| "options": areas | ||
| }, | ||
| "validations": { | ||
| "required": True | ||
| } | ||
| } | ||
|
|
||
| # Add a description field | ||
| description_field = { | ||
| "type": "textarea", | ||
| "id": "description", | ||
| "attributes": { | ||
| "label": "Describe the issue", | ||
| "description": "Provide a clear and concise description of what the issue is." | ||
| }, | ||
| "validations": { | ||
| "required": True | ||
| } | ||
| } | ||
|
|
||
| yaml_form["body"].append(dropdown) | ||
| yaml_form["body"].append(description_field) | ||
|
|
||
| # Write the YAML to a file | ||
| output_path = os.path.join(os.path.dirname(__file__), "sample_issue.yml") | ||
| with open(output_path, "w") as outfile: | ||
| yaml.dump(yaml_form, outfile, sort_keys=False) |
This file contains hidden or 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,51 @@ | ||
| name: Check Sample Issue Template | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - '.github/CODEOWNERS' | ||
| pull_request: | ||
| paths: | ||
| - '.github/CODEOWNERS' | ||
|
|
||
|
|
||
| jobs: | ||
| generate-template: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' | ||
|
|
||
| - name: Install dependencies | ||
| run: pip install pyyaml | ||
|
|
||
| - name: Run the generator script | ||
| run: python .github/ISSUE_TEMPLATE/sample_issue_generator.py | ||
|
|
||
| - name: Check for discrepancies | ||
| run: | | ||
| if git diff --quiet .github/ISSUE_TEMPLATE/sample_issue.yml; then | ||
| echo "✅ No discrepancies found. The sample issue template is up to date." | ||
| else | ||
| echo "❌ Discrepancy detected!" | ||
| echo "The CODEOWNERS file was modified, but the sample issue template is not up to date." | ||
| echo "" | ||
| echo "Please regenerate the sample issue template by running:" | ||
| echo " python .github/ISSUE_TEMPLATE/sample_issue_generator.py" | ||
| echo "" | ||
| echo "Or manually update it." | ||
| echo "" | ||
| echo "Then commit both files together:" | ||
| echo " git add .github/CODEOWNERS .github/ISSUE_TEMPLATE/sample_issue.yml" | ||
| echo " git commit -m 'Update CODEOWNERS and regenerate sample issue template'" | ||
| echo "" | ||
| echo "Differences found:" | ||
| git diff .github/ISSUE_TEMPLATE/sample_issue.yml | ||
| exit 1 | ||
| fi | ||
This file contains hidden or 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,79 @@ | ||
| name: Tag Codeowner on Sample Issue | ||
|
|
||
| on: | ||
| issues: | ||
| types: [opened] | ||
|
|
||
| jobs: | ||
| tag-codeowner: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' | ||
|
|
||
| - name: Install dependencies | ||
| run: pip install pyyaml requests | ||
|
|
||
| - name: Extract selected path and tag codeowner | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| python3 - <<EOF | ||
| import os | ||
| import re | ||
| import requests | ||
|
|
||
| issue_body = """${{ github.event.issue.body }}""" | ||
| selected_path = None | ||
|
|
||
| # Try to extract the selected path from the issue body | ||
| match = re.search(r'### Which is the area where the sample lives\?\s*\n(.+)', issue_body, re.MULTILINE) | ||
| if match: | ||
| selected_path = match.group(1).strip() | ||
|
|
||
| if not selected_path: | ||
| print("No sample path found in issue body.") | ||
| exit(0) | ||
|
|
||
| # Read CODEOWNERS | ||
| with open(".github/CODEOWNERS", "r") as f: | ||
| lines = f.readlines() | ||
|
|
||
| codeowner = None | ||
| sample_section = False | ||
| for line in lines: | ||
| line = line.strip() | ||
| if line.startswith("# Samples"): | ||
| sample_section = True | ||
| continue | ||
| if sample_section: | ||
| if line.startswith("#") or not line: | ||
| continue | ||
| path, owner = line.split() | ||
| if path == selected_path: | ||
| codeowner = owner | ||
| break | ||
|
|
||
| if codeowner is None: | ||
| print(f"No codeowner found for path: {selected_path}") | ||
| exit(0) | ||
|
|
||
| # Post a comment tagging the owner | ||
| comment = f"{codeowner} can you please take a look at this issue related to {selected_path}?" | ||
| repo = os.environ['GITHUB_REPOSITORY'] | ||
| token = os.environ['GITHUB_TOKEN'] | ||
|
|
||
| url = f"https://api.github.com/repos/{repo}/issues/${{ github.event.issue.number }}/comments" | ||
| headers = { | ||
| "Authorization": f"Bearer {token}", | ||
| "Accept": "application/vnd.github.v3+json" | ||
| } | ||
| response = requests.post(url, headers=headers, json={"body": comment}) | ||
| print("Comment posted:", response.status_code, response.text) | ||
| EOF |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.