Skip to content

Approve changelog PRs using GH reviews #7979

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

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

mads-hartmann
Copy link
Contributor

@mads-hartmann mads-hartmann commented Feb 2, 2022

Description

As part of moving to using GitHub for managing reviews instead of Prow we will be removing the /approve commands in favour of using actual GH reviews (see RFC for more details). This means that any automation that uses /approve needs to be modified.

This PR extends the changelog program to also approve the PR using GitHub. Once we have switched to GitHub Reviews entirely we can remove the comments and the lgtm and approved labels from this program, but for now the program will continue to approve using the old way while we move everything over.

Related Issue(s)

Fixes https://github.com/gitpod-io/ops/issues/841

How to test

Testing this is a bit tedious, here's a PR that shows that it was able to open a PR and approve it.

  1. Build and push a new image for changes made to dev/changelog where XX is the current version + 1
    leeway build dev/changelog:docker -Dversion=0.0.XX -DimageRepoBase=eu.gcr.io/gitpod-core-dev/dev
  2. Update the Github Action (.github/workflows/changelog.yml) to use the new image
  3. Update the GitHub Action to run the action on pushes to your branch
    on:
      push:
        branches:
          - mads/use-reviews-for-changelog
  4. Create a new branch to use as the base branch for your experiments (so you don't open PRs against main)
  5. On the branch delete a section of the CHANGELOG, e.g. the previous month
  6. Also delete a section of the CHANGELOG on your branch (it will use your branch when figuring out how far back in the past to look for PRs)
  7. Update the GitHub Action to generate the CHANGELOG updates based on PRs merged into main (the -b argument to /app/changelog update should be main instead of GITHUB_REF), but have it open PRs against your test branch (the -b argument to /app/changelog pr should be your test branch, e.g. mads/old-changelog).
  8. Push commits to your branch and see the output of the action in GitHub

Release Notes

NONE

Documentation

N/A

@mads-hartmann
Copy link
Contributor Author

mads-hartmann commented Feb 2, 2022

@JanKoehnlein when you were developing this, how did you test it? ☺️

@codecov
Copy link

codecov bot commented Feb 2, 2022

Codecov Report

Merging #7979 (34a74d3) into main (3a2fb8b) will decrease coverage by 1.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7979      +/-   ##
==========================================
- Coverage   12.01%   10.86%   -1.16%     
==========================================
  Files          20       18       -2     
  Lines        1190     1022     -168     
==========================================
- Hits          143      111      -32     
+ Misses       1043      909     -134     
+ Partials        4        2       -2     
Flag Coverage Δ
components-gitpod-cli-app 10.86% <ø> (ø)
components-local-app-app-darwin-amd64 ?
components-local-app-app-darwin-arm64 ?
components-local-app-app-linux-amd64 ?
components-local-app-app-linux-arm64 ?
components-local-app-app-windows-386 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
components/local-app/pkg/auth/pkce.go
components/local-app/pkg/auth/auth.go

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a2fb8b...34a74d3. Read the comment docs.

@mads-hartmann
Copy link
Contributor Author

Note to myself based on chat with Jan

  1. Manually build the docker image with Leeway (the component Is not part of the build) - the command below will build and push the image (for version use the current version + 1)
    leeway build dev/changelog:docker -Dversion={version} -DimageRepoBase=eu.gcr.io/gitpod-core-dev/build
    
  2. Once I have the image I should be able to manually run the steps in the GH Action to experiment a bit and see if my code changes work

@JanKoehnlein
Copy link
Contributor

@mads-hartmann I am not sure how to test this anymore, since we moved it to a GH action. But you have to manually build the next version docker files

leeway build dev/changelog:docker -Dversion={version} -DimageRepoBase=eu.gcr.io/gitpod-core-dev/build

and then update the version in the GitHub action in order to use it.

@mads-hartmann mads-hartmann force-pushed the mads/use-reviews-for-changelog branch from 0d3edc8 to 34a74d3 Compare February 3, 2022 13:38
@mads-hartmann mads-hartmann marked this pull request as ready for review February 3, 2022 13:39
@mads-hartmann
Copy link
Contributor Author

mads-hartmann commented Feb 3, 2022

@JanKoehnlein I found a (somewhat tedious) way to test program. I have left a description of how I did so in the PR in case need to test it in the future ☺️ I'm assigning you as reviewer as you have the most context ☺️

Copy link
Contributor

@JanKoehnlein JanKoehnlein left a comment

Choose a reason for hiding this comment

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

LGTM

Cool, one bot approving another 🤖

@roboquat
Copy link
Contributor

roboquat commented Feb 3, 2022

LGTM label has been added.

Git tree hash: 8c08dc8b83cbb68666156d65f0dfb90c36e0fafc

@roboquat
Copy link
Contributor

roboquat commented Feb 3, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JanKoehnlein

Associated issue: #841

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat merged commit 0daf64c into main Feb 3, 2022
@roboquat roboquat deleted the mads/use-reviews-for-changelog branch February 3, 2022 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants