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

feat: log-merge-group-failure #31

Merged
merged 3 commits into from
Dec 10, 2024
Merged

Conversation

itsyoboieltr
Copy link
Contributor

@itsyoboieltr itsyoboieltr commented Nov 28, 2024

This PR creates a new reusable workflow that will be used to write data to google sheets when the merge group event fails. A reusable workflow is preferred, so that mobile and extension can make use of the same implementation. Environment variables (= GitHub secrets) are required to configure:

  • GOOGLE_APPLICATION_CREDENTIALS, GOOGLE_SERVICE_ACCOUNT: The google service account that is used for authentication with the google sheets api.
    • The service account needs to have access to the google sheet you intend to operate on. To give access to the google sheet, you need to click the "Share" button in the top-right corner. Enter the service account's email (can be found on google cloud console), give "Editor" permissions. After this, the service account will have access to this spreadsheet, allowing read and write operations.
  • SPREADSHEET_ID: unique identifier that can be found in the url when you open the google sheet
  • SHEET_NAME: name of a sheet in a spreadsheet that can be found on the bottom

Short summary of what happens in the workflow:

  1. Google api authentication setup
  2. Check if current date exists in the spreadsheet
  3. If current date exists, increment number of PRs by 1
  4. If current date does not exist, create a new row with the current date, and the number 1 (so that it can be incremented later, if more merge group events fail on the same day).

Spreadsheet here: https://docs.google.com/spreadsheets/d/11niHgT_E2YzzXHXQSxX5LNdA6i0GG5aa-OZWvn7_-o4

Dashboard here: https://lookerstudio.google.com/u/1/reporting/e7e8f90e-72aa-4128-ae01-6305bf3393f4/page/p_pz1dszarmd

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3400

@itsyoboieltr itsyoboieltr changed the title feat: log-merge-group-failure.yml feat: log-merge-group-failure Nov 28, 2024
@itsyoboieltr itsyoboieltr requested review from Gudahtt and danjm December 9, 2024 19:05
Copy link

@danjm danjm left a comment

Choose a reason for hiding this comment

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

LGTM

@itsyoboieltr itsyoboieltr merged commit 6bbad33 into main Dec 10, 2024
7 checks passed
@itsyoboieltr itsyoboieltr deleted the feat/log-merge-group-failure branch December 10, 2024 19:01
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Dec 11, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28799?quickstart=1)

This PR integrates the new reusable workflow
(MetaMask/github-tools#31) that can be used to
write data to google sheets when the merge group event fails.
Environment variables (= GitHub secrets) are required to configure:
- GOOGLE_APPLICATION_CREDENTIALS, GOOGLE_SERVICE_ACCOUNT: The google
service account that is used for authentication with the google sheets
api.
- The service account needs to have access to the google sheet you
intend to operate on. To give access to the google sheet, you need to
click the "Share" button in the top-right corner. Enter the service
account's email (can be found on google cloud console), give "Editor"
permissions. After this, the service account will have access to this
spreadsheet, allowing read and write operations.
- SPREADSHEET_ID: unique identifier that can be found in the url when
you open the google sheet
- SHEET_NAME: name of a sheet in a spreadsheet that can be found on the
bottom

Short summary of what happens in the workflow:
1. Google api authentication setup
2. Check if current date exists in the spreadsheet
3. If current date exists, increment number of PRs by 1
4. If current date does not exist, create a new row with the current
date, and the number 1 (so that it can be incremented later, if more
merge group events fail on the same day).

Spreadsheet here:
https://docs.google.com/spreadsheets/d/11niHgT_E2YzzXHXQSxX5LNdA6i0GG5aa-OZWvn7_-o4

Dashboard here:
https://lookerstudio.google.com/u/1/reporting/e7e8f90e-72aa-4128-ae01-6305bf3393f4/page/p_pz1dszarmd

## **Related issues**

Fixes: MetaMask/MetaMask-planning#3400

## **Manual testing steps**

1. When the workflow runs, depending on the state of the spreadsheet:
- If the current date already exists, the number of PRs removed from the
merge queue should be incremented by 1.
- If the current date does not exist, a new row should be added with the
current date, and the number of PRs should be set to 1.

I created a private repository to test it, and there it worked. The
actual production usage can only be tested if we merge and see if
anything gets removed from the merge queue, in this case the spreadsheet
should get updated.

## **Screenshots/Recordings**

Not applicable

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Dec 11, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28799?quickstart=1)

This PR integrates the new reusable workflow
(MetaMask/github-tools#31) that can be used to
write data to google sheets when the merge group event fails.
Environment variables (= GitHub secrets) are required to configure:
- GOOGLE_APPLICATION_CREDENTIALS, GOOGLE_SERVICE_ACCOUNT: The google
service account that is used for authentication with the google sheets
api.
- The service account needs to have access to the google sheet you
intend to operate on. To give access to the google sheet, you need to
click the "Share" button in the top-right corner. Enter the service
account's email (can be found on google cloud console), give "Editor"
permissions. After this, the service account will have access to this
spreadsheet, allowing read and write operations.
- SPREADSHEET_ID: unique identifier that can be found in the url when
you open the google sheet
- SHEET_NAME: name of a sheet in a spreadsheet that can be found on the
bottom

Short summary of what happens in the workflow:
1. Google api authentication setup
2. Check if current date exists in the spreadsheet
3. If current date exists, increment number of PRs by 1
4. If current date does not exist, create a new row with the current
date, and the number 1 (so that it can be incremented later, if more
merge group events fail on the same day).

Spreadsheet here:
https://docs.google.com/spreadsheets/d/11niHgT_E2YzzXHXQSxX5LNdA6i0GG5aa-OZWvn7_-o4

Dashboard here:
https://lookerstudio.google.com/u/1/reporting/e7e8f90e-72aa-4128-ae01-6305bf3393f4/page/p_pz1dszarmd

## **Related issues**

Fixes: MetaMask/MetaMask-planning#3400

## **Manual testing steps**

1. When the workflow runs, depending on the state of the spreadsheet:
- If the current date already exists, the number of PRs removed from the
merge queue should be incremented by 1.
- If the current date does not exist, a new row should be added with the
current date, and the number of PRs should be set to 1.

I created a private repository to test it, and there it worked. The
actual production usage can only be tested if we merge and see if
anything gets removed from the merge queue, in this case the spreadsheet
should get updated.

## **Screenshots/Recordings**

Not applicable

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants