Skip to content

Refactor docbot and add tests - #69

Merged
lhotari merged 1 commit into
apache:masterfrom
nodece:master
Sep 6, 2022
Merged

lhotari merged 1 commit into
apache:masterfrom
nodece:master

Conversation

@nodece

@nodece nodece commented Aug 29, 2022

Copy link
Copy Markdown
Member

Motivation

  1. Fix [docbot] Cannot to label for PR correctly #59
  2. Add tests to cover this feature

Verify

I verified this on my repo, please help verify the following case on your repo if you have time, thanks!

  1. Checked single checkbox
  2. Checked multiple checkboxes
  3. Unchecked any checkboxes, waited for CI to have done, then checked one checkbox

Workflow:

name: Documentation Bot

on:
  pull_request_target :
    types:
      - opened
      - edited
      - labeled
      - unlabeled

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
  cancel-in-progress: true

jobs:
  label:
    permissions:
      pull-requests: write 
    runs-on: ubuntu-latest
    steps:
      - name: Labeling
        uses: nodece/pulsar-test-infra/docbot@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          LABEL_WATCH_LIST: 'doc,doc-required,doc-not-needed,doc-complete'
          LABEL_MISSING: 'doc-label-missing'

You also need to setting your Workflow permissions, see https://github.com/$username/$repo/settings/actions.

@nodece

nodece commented Aug 29, 2022

Copy link
Copy Markdown
Member Author

Hi @tisonkun and @maxsxu, could help review this PR?

Comment thread docbot/action.yml Outdated
uses: actions/checkout@v3
with:
repository: apache/pulsar-test-infra
repository: nodece/pulsar-test-infra

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When this PR is ready for review, I will reset this config.

@nodece
nodece marked this pull request as draft August 29, 2022 11:36
@nodece

nodece commented Aug 29, 2022 •

Copy link
Copy Markdown
Member Author

Convert to draft for testing.

Comment thread docbot/main.go Resolved

@tisonkun tisonkun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally looks good. Comments inline for code quality.

I'd prefer to trigger tests for each CI but we can do it as some follow-ups.

Comment thread docbot/action_config.go Resolved
Comment thread docbot/action_test.go Resolved
Comment thread docbot/action.go Resolved
Comment thread docbot/action.go Resolved
Comment thread docbot/action.go Resolved
Comment thread docbot/action.go Resolved
Comment thread docbot/action.go Resolved
@nodece

nodece commented Sep 5, 2022

Copy link
Copy Markdown
Member Author

Hi @tisonkun, Thanks for your review, these request has been fixed.

@nodece
nodece marked this pull request as ready for review September 5, 2022 10:28
Comment thread docbot/action_test.go Resolved

@tisonkun tisonkun left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

cc @maxsxu @michaeljmarshall @lhotari could you help with reviewing?

@maxsxu maxsxu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for driving this work! But this PR is a little bit impractical to review. I would suggest making this PR into two separate PR:

  • One PR focus on fixing the issue
  • Another PR focus on refactoring

What do you think?

@tisonkun

tisonkun commented Sep 5, 2022 •

Copy link
Copy Markdown
Member

@maxsxu Aha, I see your point. @nodece doesn't describe the changes he made besides the refactoring.

I read the new code file by file and confirm that the functionality changes are included as this #59 (comment) described, that is, handling all actions in the same way. The remaining is semantically identical refactoring and some tests.

From my perspective, it's a bit overwhelming to ask the contributor to do the separations while we can review it. Let me know if with this additional info helps.

@nodece

nodece commented Sep 6, 2022 •

Copy link
Copy Markdown
Member Author

I can split this PR because this PR is complex for the reviewer.

But it still is complex, because we have the same code snippet in the code, which we need to clean up.

Currently, no diff view on GitHub, I can merge these changes to original file.

@lhotari
lhotari merged commit f7f525d into apache:master Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docbot] Cannot to label for PR correctly

4 participants