From 90019cc6bc770f26b82882673d1779f0d5712158 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 24 Dec 2023 21:30:39 +0100 Subject: [PATCH] [code-infra] Sync bug issue template --- .github/ISSUE_TEMPLATE/1.bug.yml | 29 ++++++++-------- .github/workflows/issue-cleanup.yml | 52 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/issue-cleanup.yml diff --git a/.github/ISSUE_TEMPLATE/1.bug.yml b/.github/ISSUE_TEMPLATE/1.bug.yml index 003fbb8..2314848 100644 --- a/.github/ISSUE_TEMPLATE/1.bug.yml +++ b/.github/ISSUE_TEMPLATE/1.bug.yml @@ -8,13 +8,13 @@ body: Please provide a searchable summary of the issue in the title above ⬆️. Thanks for contributing by creating an issue! ❤️ - - type: checkboxes + - type: input attributes: - label: Duplicates - description: Please [search the history](https://github.com/mui/mui-public/issues) to see if an issue already exists for the same problem. - options: - - label: I have searched the existing issues - required: true + label: Search keywords + description: Your issue may have already been reported! List the keywords you've used to search the [existing issues](https://github.com/mui/mui-public/issues). This will also make your issue searchable for others. + placeholder: e.g. datagrid column resizing + validations: + required: true - type: checkboxes attributes: label: Latest version @@ -24,34 +24,31 @@ body: required: true - type: textarea attributes: - label: Steps to reproduce 🕹 + label: Steps to reproduce description: | - **⚠️ Issues that we can't reproduce will be closed.** - - Please provide a link to a live example and an unambiguous set of steps to reproduce this bug. + **⚠️ Issues that we can't reproduce can't be fixed.** value: | - Link to live example: + Link to live example: (required) Steps: - 1. 2. 3. - type: textarea attributes: - label: Current behavior 😯 + label: Current behavior description: Describe what happens instead of the expected behavior. - type: textarea attributes: - label: Expected behavior 🤔 + label: Expected behavior description: Describe what should happen. - type: textarea attributes: - label: Context 🔦 + label: Context description: What are you trying to accomplish? How has this issue affected you? Providing context helps us come up with a solution that is more useful in the real world. - type: textarea attributes: - label: Your environment 🌎 + label: Your environment description: Run `npx @mui/envinfo` and post the results. If you encounter issues with TypeScript please include the used tsconfig. value: |
diff --git a/.github/workflows/issue-cleanup.yml b/.github/workflows/issue-cleanup.yml new file mode 100644 index 0000000..dab93c5 --- /dev/null +++ b/.github/workflows/issue-cleanup.yml @@ -0,0 +1,52 @@ +name: Cleanup issue comment + +on: + issues: + types: + - opened + +permissions: {} + +jobs: + issue_cleanup: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6 + with: + script: | + const issue = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }) + + const lines = issue.data.body.split('\n') + + const _ = extractInputSection(lines, 'Latest version') + const searchKeywords = extractInputSection(lines, 'Search keywords') + const orderID = extractInputSection(lines, 'Order ID or Support key') + + lines.push('') + lines.push('**Search keywords**: ' + searchKeywords) + if (orderID !== '' && orderID !== '_No response_') { + lines.push('**Order ID**: ' + orderID) + } + + const body = lines.join('\n') + + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body, + }) + + function extractInputSection(lines, title) { + const index = lines.findIndex(line => line.startsWith('###') && line.includes(title)) + if (index === -1) { + return '' + } + return lines.splice(index, 4)[2].trim() + }