Browse Source

Upgrade template validation to new GH Issue Form (#26898)

Chad Whitacre 3 years ago
parent
commit
38d221010c

+ 52 - 0
.github/ISSUE_TEMPLATE/bug.yml

@@ -0,0 +1,52 @@
+name: 🐞 Bug Report
+description: Tell us about something that's not working the way we (probably) intend.
+body:
+  - type: dropdown
+    id: environment
+    attributes:
+      label: Environment
+      description: Where are you using our software?
+      options:
+        - SaaS (https://sentry.io/)
+        - self-hosted (`onpremise` deployment)
+    validations:
+      required: true
+  - type: input
+    id: version
+    attributes:
+      label: Version
+      placeholder: 21.7.0 ← should look like this (check the footer)
+      description: If self-hosted, what version are you running?
+    validations:
+      required: false
+  - type: textarea
+    id: repro
+    attributes:
+      label: Steps to Reproduce
+      description: How can we see what you're seeing? Specific is terrific.
+      value: |-
+        1. foo
+        2. bar
+        3. baz
+    validations:
+      required: true
+  - type: textarea
+    id: expected
+    attributes:
+      label: Expected Result
+    validations:
+      required: true
+  - type: textarea
+    id: actual
+    attributes:
+      label: Actual Result
+      description: Logs? Screenshots? Yes, please.
+    validations:
+      required: true
+  - type: markdown
+    attributes:
+      value: |-
+        ## Thanks πŸ™
+        Check our [triage docs](https://open.sentry.io/triage/) for what to expect next.
+    validations:
+      required: false

+ 0 - 37
.github/ISSUE_TEMPLATE/bug_report.md

@@ -1,37 +0,0 @@
----
-name: 🐞 Bug Report
-about: Report a bug to help improve Sentry
----
-
-<!-- WARNING: DO NOT remove any of the headers below or your issue will automatically be closed by our bot -->
-
-## Important Details
-
-How are you running Sentry?
-
-<!-- Please pick one of the following -->
-On-Premise w/ Docker, version x.y.z
-<!-- --------------- -->
-Saas (sentry.io)
-<!-- --------------- -->
-Other, version x.y.z, [briefly describe your environment]
-<!-- --------------- -->
-
-## Description
-
-[What happened]
-
-## Steps to Reproduce
-
-1. [First Step]
-2. [Second Step]
-3. and so on.
-
-Good items to include here include:
-
-- Include a stacktrace or other logs when relevant
-- Include a redacted version of your configuration (`sentry.conf.py` and `config.yml` files) when relevant
-
-### What you expected to happen
-
-[What you think should be happening]

+ 28 - 0
.github/ISSUE_TEMPLATE/feature.yml

@@ -0,0 +1,28 @@
+name: πŸ’‘ Feature Request
+description: Tell us about a problem our software could solve but doesn't.
+body:
+  - type: textarea
+    id: problem
+    attributes:
+      label: Problem Statement
+      description: What problem could Sentry solve that it doesn't?
+      placeholder: |-
+        I want to make whirled peas, but Sentry doesn't blend.
+    validations:
+      required: true
+  - type: textarea
+    id: expected
+    attributes:
+      label: Solution Brainstorm
+      description: We know you have bright ideas to share ... share away, friend.
+      placeholder: |-
+        Add a blender to Sentry.
+    validations:
+      required: false
+  - type: markdown
+    attributes:
+      value: |-
+        ## Thanks πŸ™
+        Check our [triage docs](https://open.sentry.io/triage/) for what to expect next.
+    validations:
+      required: false

+ 0 - 28
.github/ISSUE_TEMPLATE/feature_request.md

@@ -1,28 +0,0 @@
----
-name: 🧠  Feature request
-about: Suggest an idea for this project
-
----
-
-<!--
-
-Note that the Sentry team has finite resources and priorities that are not
-always visible on GitHub. If your issue doesn't align with our priorities it's
-unlikely it will be worked on. If we're interested in a particular feature however,
-we'll follow up and ask you to submit an RFC to talk about it in more detail.
-
--->
-
-## Summary
-
-One paragraph description of the feature.
-
-## Motivation
-
-Why should this be worked on? What problems or use cases does it solve or
-improve?
-
-## Additional Context
-
-Any other context or screenshots or API request payload/responses that you
-pertain to the feature.

+ 0 - 100
.github/workflows/validate-new-issue.yml

@@ -1,100 +0,0 @@
-name: Validate new issue
-on:
-  issues:
-    types: ["opened"]
-jobs:
-  validate-new-issue:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-      - name: "Validate new issue"
-        shell: bash
-        env:
-          GITHUB_TOKEN: ${{ github.token }}
-        run: |
-          issue_number=${{ github.event.issue.number }}
-          echo "Validating issue #${issue_number}."
-
-          # Trust users who belong to the getsentry org.
-          if gh api "https://api.github.com/orgs/getsentry/members/${{ github.actor }}" >/dev/null 2>&1; then
-            echo "Skipping validation, because ${{ github.actor }} is a member of the getsentry org."
-            exit 0
-          else
-            echo "${{ github.actor }} is not a member of the getsentry org. 🧐"
-          fi
-
-          # Helper
-          function gh-issue-label() {
-            gh api "/repos/:owner/:repo/issues/${1}/labels" \
-              -X POST \
-              --input <(echo "{\"labels\":[\"$2\"]}")
-          }
-
-          # Prep reasons for error message comment.
-          REASON="your issue does not properly use one of this repo's available issue templates"
-          REASON_EXACT_MATCH="you created an issue from a template without filling in anything"
-          REASON_EMPTY="you created an empty issue"
-
-          BASE_CASE_TITLE="validation bot is confused"
-
-          # Definition of valid:
-          # - is a report about buggy validation πŸ˜… or ...
-          # - not empty (ignoring whitespace)
-          # - matches a template
-          #   - at least one of the headings are also in this issue
-          #   - extra headings in the issue are fine
-          #   - order doesn't matter
-          #   - case-sensitive tho
-          # - not an *exact* match for a template (ignoring whitespace)
-
-          jq -r .issue.title "$GITHUB_EVENT_PATH" > issue-title
-          if diff issue-title <(echo "$BASE_CASE_TITLE") > /dev/null; then
-            echo "Infinite recursion avoided."
-            exit 0
-          fi
-
-          function extract-headings { { sed 's/\r$//' "$1" | grep '^#' || echo -n ''; } | sort; }
-          jq -r .issue.body "$GITHUB_EVENT_PATH" > issue
-          if ! grep -q '[^[:space:]]' issue; then
-            REASON="${REASON_EMPTY}"
-          else
-            extract-headings <(cat issue) > headings-in-issue
-            for template in $(ls .github/ISSUE_TEMPLATE/*.md 2> /dev/null); do
-              # Strip front matter. https://stackoverflow.com/a/29292490/14946704
-              sed -i'' '1{/^---$/!q;};1,/^---$/d' "$template"
-              extract-headings "$template" > headings-in-template
-              echo -n "$(basename $template)? "
-              if [ ! -s headings-in-template ]; then
-                echo "No headers in template. 🀷"
-              elif [ "$(comm -12 headings-in-template headings-in-issue)" ]; then
-                echo "Match! πŸ‘ πŸ’ƒ"
-                if diff -Bw "$template" issue > /dev/null; then
-                  echo "... like, an /exact/ match. πŸ˜–"
-                  REASON="${REASON_EXACT_MATCH}"
-                  break
-                else
-                  gh-issue-label "${issue_number}" "Status: Unrouted"
-                  exit 0
-                fi
-              else
-                echo "No match. πŸ‘Ž"
-              fi
-            done
-          fi
-
-          # Failed validation! Close the issue with a comment and a label.
-          cat << EOF > comment
-          Sorry, friend. As far as this ol' bot can tell, ${REASON}. Please [try again](https://github.com/${{ github.repository }}/issues/new/choose), if you like. (And if I'm confused, please [let us know](https://github.com/getsentry/.github/issues/new?title=$(echo "$BASE_CASE_TITLE" | tr ' ' '+')&body=${{ github.event.issue.html_url }}). 😬)
-
-          ----
-
-          [![Did you see the memo about this?](https://user-images.githubusercontent.com/134455/104515469-e04a9c80-55c0-11eb-8e15-ffe9c0b8dd7f.gif)](https://www.youtube.com/watch?v=Fy3rjQGc6lA)
-
-          ([log](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}))
-          EOF
-
-          echo -n "Commented: "
-          gh issue comment "${issue_number}" --body "$(cat comment)"
-          gh-issue-label "${issue_number}" "Status: Invalid"
-          gh issue close "${issue_number}"
-          echo "Closed with: \"${REASON}.\""