Skip to content
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

ci: Github action to check issue body matches issues templates and add labels to issue when needed #7379

Merged
merged 6 commits into from
Oct 11, 2023

Conversation

gauthierpetetin
Copy link
Contributor

@gauthierpetetin gauthierpetetin commented Oct 4, 2023

Description

This PR introduces a new Github action, to achieve the following:

  1. Check if issue matches an existing issue template ('general-issue.yml' or 'bug-report.yml')
  2. Add an INVALID-ISSUE-TEMPLATE label in case issue doesn't match any of the templates
  3. Add an external-contributor label in case issue was created by someone external to the MetaMask organisation
  4. Add a regression-prod-x.y.z label when possible, when x.y.z value can be extracted from 'bug-report.yml' template

We will be able to leverage regression-prod-x.y.z and external-contributor labels to improve our bug triage process and our metrics collection.

Same PR for Extension repo

Manual testing steps

  1. Go on this test repo
  2. Fill the bug report issue form
  3. Make sure the release version you indicate in the form has x.y.z format
  4. Click on "Submit new issue"
  5. Wait for ~30s and 2 new labels shall appear on the issue you just created (regression-prod-x.y.z and external-contributor)
  6. Edit the issue's description by indicating a different release version
  7. Wait for ~30s and the regression-prod-x.y.z shall be updated accordingly
  8. Edit the issue by deleting the whole description
  9. Wait for ~30s and the INVALID-ISSUE-TEMPLATE shall be added

Screenshots/Recordings

Before

NA

After

https://recordit.co/Sq7fvCwkr5

Related issues

Fixes https://github.com/MetaMask/mobile-planning/issues/1293

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained:
    • What problem this PR is solving.
    • How this problem was solved.
    • How reviewers can test my changes.
  • I’ve indicated what issue this PR is linked to: Fixes #???
  • I’ve included tests if applicable.
  • I’ve documented any added code.
  • I’ve applied the right labels on the PR (see labeling guidelines).
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

…tected with a label

The new bug report template makes it mandatory to indicate what release version the bug was detected in. We want to exploit that information by extracting the version number from issue body and indicate it by adding corresponding regression prod label on the issue. In addition to it, we also want to add a label to indicate when the bug has been reported by someone external to the MetaMask organisation. We will be able to leverage these two new labels to improve our bug triage process and our metrics collection.
@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2023

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@socket-security
Copy link

socket-security bot commented Oct 4, 2023

No top level dependency changes detected. Learn more about Socket for GitHub ↗︎

@socket-security
Copy link

socket-security bot commented Oct 4, 2023

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (19d8a77) 34.60% compared to head (5c30d3a) 34.60%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7379   +/-   ##
=======================================
  Coverage   34.60%   34.60%           
=======================================
  Files        1019     1019           
  Lines       27192    27192           
  Branches     2212     2212           
=======================================
  Hits         9409     9409           
  Misses      17295    17295           
  Partials      488      488           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gauthierpetetin gauthierpetetin added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Oct 4, 2023
…s to achieve

The github action was initially only meant to add regression-prod labels while the scope is nox extended, which is why it's worth renaming a few things to reflect it.
@gauthierpetetin gauthierpetetin changed the title New action to indicate release version where bug was detected with a label Github action to check issue body matches issues templates and add labels to issue when needed Oct 5, 2023
@wachunei
Copy link
Member

wachunei commented Oct 5, 2023

Would it be possible for the issue template to indicate the required sections as HTML comments? I usually delete the screenshots sections when the code is not related to the UI, eg:

<!-- Required, don't delete -->
### Screenshots

@Cal-L
Copy link
Contributor

Cal-L commented Oct 9, 2023

Would it be possible for the issue template to indicate the required sections as HTML comments? I usually delete the screenshots sections when the code is not related to the UI, eg:

<!-- Required, don't delete -->
### Screenshots

@gauthierpetetin on Pedro's note - Would it make sense to check post editing if required fields are still populated and apply the invalid label accordingly? For example, I can edit the issue and provide an empty string in the description section and it would still be considered valid. Or do you think that would be too much friction for contributors?

@gauthierpetetin
Copy link
Contributor Author

Would it be possible for the issue template to indicate the required sections as HTML comments?

@wachunei the majority of sections are optional in the new templates we introduced in September, and get automatically filled with _No response_ string in case you don't provide any info. Besides leaving the section as optional, the intention was to prevent behaviours where engineers would systematically delete all optional sections from issue's description, without considering them one by one and asking themselves whether or not they have some info to provide for each section. In your situation, would it be ok to leave the screenshots section empty, rather than deleting it?

Would it make sense to check post editing if required fields are still populated and apply the invalid label accordingly?

@Cal-L the Github action is triggered every time, issue gets created or updated (cf. here) and labels are updated accordingly. Does that correspond to what you suggest?

@Cal-L
Copy link
Contributor

Cal-L commented Oct 9, 2023

What I meant was if you delete the body of the description post issue creation, it doesn't see it as invalid.

@gauthierpetetin
Copy link
Contributor Author

@Cal-L the behaviour you describe seems included in this PR (cf. second 25' in the recording). Do you confirm?

@Cal-L
Copy link
Contributor

Cal-L commented Oct 10, 2023

@Cal-L the behaviour you describe seems included in this PR (cf. second 25' in the recording). Do you confirm?

Since these changes are meant to verify the template and not necessarily the body content, will consider it out of scope.

@Cal-L Cal-L changed the title Github action to check issue body matches issues templates and add labels to issue when needed improvement: Github action to check issue body matches issues templates and add labels to issue when needed Oct 10, 2023
@Cal-L Cal-L added No QA Needed/E2E Only Apply this label when your PR does not need any QA effort. and removed needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Oct 10, 2023
@Cal-L Cal-L changed the title improvement: Github action to check issue body matches issues templates and add labels to issue when needed ci: Github action to check issue body matches issues templates and add labels to issue when needed Oct 10, 2023
Cal-L
Cal-L previously approved these changes Oct 11, 2023
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

…iles

Nicholas Ellul raised that the script would not be able to retrieve list of organisations for users who have their GitHub set to private mode. As a consequence, these users would appear as external contributors while they are not. This commit introduces a different way to check if users belong to the MetaMask organisation, which allows to support even users with private profiles.
@gauthierpetetin
Copy link
Contributor Author

I just pushed one last fix to address @NicholasEllul 's comment made here.

Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sonarcloud
Copy link

sonarcloud bot commented Oct 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@gauthierpetetin gauthierpetetin merged commit 76a677c into main Oct 11, 2023
24 checks passed
@gauthierpetetin gauthierpetetin deleted the feat/bug-report-labeling branch October 11, 2023 22:45
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
No QA Needed/E2E Only Apply this label when your PR does not need any QA effort. release-7.10.0 team-mobile-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants