diff options
| author | 5an7y-Microsoft <[email protected]> | 2026-03-19 10:01:54 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-19 10:01:54 -0700 |
| commit | 21d568661684c410e8b2d290f5ee33787cd73de5 (patch) | |
| tree | d7a9d7ca84e87fef68f616aba1efee3a48b49b82 /.github | |
| parent | 77d8f2d6ca1283718626965b53c69477bffb5fa8 (diff) | |
| parent | 925b2587f5cd6b19fa37bd766c1b568f2e277309 (diff) | |
Merge pull request #1358 from microsoft/main
FI main to develop
Diffstat (limited to '.github')
| -rw-r--r-- | .github/CODEOWNERS | 2 | ||||
| -rw-r--r-- | .github/ISSUE_TEMPLATE/sample_issue.yml | 75 | ||||
| -rw-r--r-- | .github/ISSUE_TEMPLATE/sample_issue_generator.py | 72 | ||||
| -rw-r--r-- | .github/workflows/StaleIssues.yml | 16 | ||||
| -rw-r--r-- | .github/workflows/check-sample-issue-template.yml | 50 | ||||
| -rw-r--r-- | .github/workflows/tag-codeowner-on-issue.yml | 82 |
6 files changed, 297 insertions, 0 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index be83c18d..093db174 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,6 +10,8 @@ # Windows Implementation Library submodule /wil/ @microsoft/driver-samples-maintainers +# Samples + # Audio /audio/ @microsoft/windowsaudio diff --git a/.github/ISSUE_TEMPLATE/sample_issue.yml b/.github/ISSUE_TEMPLATE/sample_issue.yml new file mode 100644 index 00000000..4597086a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/sample_issue.yml @@ -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 diff --git a/.github/ISSUE_TEMPLATE/sample_issue_generator.py b/.github/ISSUE_TEMPLATE/sample_issue_generator.py new file mode 100644 index 00000000..4b6eee64 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/sample_issue_generator.py @@ -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) diff --git a/.github/workflows/StaleIssues.yml b/.github/workflows/StaleIssues.yml new file mode 100644 index 00000000..d3a3776a --- /dev/null +++ b/.github/workflows/StaleIssues.yml @@ -0,0 +1,16 @@ +name: Close inactive issues +on: + workflow_dispatch: +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/stale@v10 + with: + days-before-issue-stale: 365 + stale-issue-label: "stale" + stale-issue-message: "This issue has been inactive for a year. It will be closed in 31 days if no further activity occurs. If you believe this issue is still relevant, please comment to keep it open." + operations-per-run: 400 + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/check-sample-issue-template.yml b/.github/workflows/check-sample-issue-template.yml new file mode 100644 index 00000000..7e17bedd --- /dev/null +++ b/.github/workflows/check-sample-issue-template.yml @@ -0,0 +1,50 @@ +name: Check Sample Issue Template + +on: + pull_request: + paths: + - '.github/CODEOWNERS' + - '.github/ISSUE_TEMPLATE/sample_issue.yml' + - '.github/ISSUE_TEMPLATE/sample_issue_generator.py' + + +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 diff --git a/.github/workflows/tag-codeowner-on-issue.yml b/.github/workflows/tag-codeowner-on-issue.yml new file mode 100644 index 00000000..a4fe365d --- /dev/null +++ b/.github/workflows/tag-codeowner-on-issue.yml @@ -0,0 +1,82 @@ +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 }} + ISSUE_BODY: ${{ github.event.issue.body }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + run: | + python3 - <<EOF + import os + import re + import requests + + issue_body = os.environ['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'] + issue_number = os.environ['ISSUE_NUMBER'] + + url = f"https://api.github.com/repos/{repo}/issues/{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 |
