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

Approve a PR by leaving "/lgtm" comment #153

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/add-remove-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ on:
pull_request_target:
types: [synchronize]

pull_request_review:
pull_request_review_comment:
types: [created]

issue_comment:
types: [created, edited, deleted]
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/lgtm-approval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Approve PR on /lgtm comment

on:
workflow_dispatch: #manual testing
issue_comment:
types: [created]
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add condition to trigger only if "lgtm in comment"
e/g

    if: |
      contains(github.event.comment.body, '/lgtm')

also should be triggered on edited

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The actions already checks if /lgtm is int he comment: https://github.com/opendatahub-io/opendatahub-tests/pull/153/files#diff-8adeafbcbe79cc05a3ae753fd95a88451697a3356e53b468f8a7f565c5c737d1R13
Why would we edit a comment to add a lgtm? that seems unlikely to be honest

Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. i think adding the check on the content of the comment at the top makes it more clear
  2. a user can edit a comment and add "lgtm"


jobs:
approve-pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: github.event.issue.pull_request && contains(github.event.comment.body, '/lgtm')
steps:
- name: extract PR number
run: echo "PR_NUMBER=${{ github.event.issue.number }}" >> $GITHUB_ENV

- name: approve the PR
uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ env.PR_NUMBER }}
Loading