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: add workflow to enable voting #1120

Merged
merged 27 commits into from
Apr 9, 2024

Conversation

AayushSaini101
Copy link
Contributor

Resolve: #1093

  • Added .gitvote yml file to enable voting by TSC Members
  • Added workflow to add vote label after executing /vote command/
  • Added workflow to remove vote label when /cancel-vote executed

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@AayushSaini101 AayushSaini101 changed the title Add workflow to enable voting feat: Add workflow to enable voting Mar 24, 2024
@AayushSaini101 AayushSaini101 changed the title feat: Add workflow to enable voting feat: add workflow to enable voting Mar 24, 2024
@AayushSaini101
Copy link
Contributor Author

AayushSaini101 commented Mar 24, 2024

@derberg Do I need to add documentation of the workflow here ? and regarding the vote-passed and vote not passed, Do I need to send a notification on Slack? or need to send a mail

@AayushSaini101
Copy link
Contributor Author

Testing of Workflow: AayushSaini101/Vote#14

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

you're duplicating verification of TSC member.

please move that step into a reusable simple action like this https://github.com/asyncapi/.github/blob/master/.github/actions/get-node-version-from-package-lock/action.yml in .github repo

you can see how it is used in https://github.com/asyncapi/.github/blob/master/.github/workflows/if-nodejs-release.yml#L49

we will use this action more ofter, so better to move it into .github as reusable action now.


regarding docs -> please create a new VOTING.md document

steps:
- uses: actions/checkout@v3

- name: Get the comment body
Copy link
Member

Choose a reason for hiding this comment

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

why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed @derberg thanks

.gitvote.yml Outdated
allowed_voters:
teams:
- tsc_members
users:
Copy link
Member

Choose a reason for hiding this comment

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

all of them should be in tsc_members so no need to explicitly list users

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added new yaml file

with:
script: |
const fs = require('fs');
const filePath = 'TSC_MEMBERS.json';
Copy link
Member

Choose a reason for hiding this comment

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

wrong file, your source of truth is https://github.com/asyncapi/community/blob/master/MAINTAINERS.yaml and entries with isTscMember set to true

also when you will be refactoring your code, please do not use old callbacks but do modern code with async/await

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed thanks @derberg

}
});

- name: Add the label
Copy link
Member

Choose a reason for hiding this comment

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

we also need a step that will post a comment back in case not TSC member added /vote, to put a message that only TSC members can do it

here you have example how to do it: https://github.com/asyncapi/.github/blob/master/.github/workflows/bounty-program-commands.yml#L33

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@derberg when we allowed only TSC members voting, this will be double check, The user will be filter out when the it is not matching with the authorised voters, this will be message.

AayushSaini101/Vote#15 (comment)

Which is not a proper message by a gitvote-bot, we can allow voting for all contributors, then we can provide the custom comment not default one, This would be the best way to describe the situation in comments, instead of using default comments of the particular vote, What do you think ? @derberg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The representation of the templates of the gitvote is not proper for unauthorised vote https://github.com/cncf/gitvote/tree/main/templates, We can modify easily and make proper by changing own workflow as you shared in this https://github.com/asyncapi/.github/blob/master/.github/workflows/bounty-program-commands.yml#L33

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be the message when unauthorised author commented:
image

Copy link
Member

Choose a reason for hiding this comment

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

oh yeah, if git vote bot does the verification for us, then we should use it and not do it on our own as we will the over communicate, duplicate it kinda

Copy link
Contributor Author

@AayushSaini101 AayushSaini101 Mar 28, 2024

Choose a reason for hiding this comment

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

We cannot test the /vote command in the individual account need to use in the community, Reference cncf/gitvote#480

  • i removed)%20%26%26%20env) the authorised for the /vote command, it will be handled by gitvote workflow
  • The /cancel-vote command authorisation will be handled by our workflow not by bot one, Reference: sdf AayushSaini101/Vote#29 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we also need a step that will post a comment back in case not TSC member added /vote, to put a message that only TSC members can do it

here you have example how to do it: https://github.com/asyncapi/.github/blob/master/.github/workflows/bounty-program-commands.yml#L33
Thanks @derberg Done AayushSaini101/Vote#29 (comment) Testing

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

remember to ping me @AayushSaini101 in case you are ready for another review round

@AayushSaini101
Copy link
Contributor Author

remember to ping me @AayushSaini101 in case you are ready for another review round

Yes @derberg please review I have one concern regarding the /vote command added comment above

@derberg
Copy link
Member

derberg commented Apr 3, 2024

why do we need tsc_members.yaml file?

@AayushSaini101
Copy link
Contributor Author

AayushSaini101 commented Apr 3, 2024

why do we need tsc_members.yaml file?

@derberg I want to test whether the .gitvote.yml is authorising the tsc_members from yml file or not. I cannot test on my person repo. cncf/gitvote#480 Reference: I just need to check whether it is allowing voting or not in this way.

@derberg
Copy link
Member

derberg commented Apr 3, 2024

@AayushSaini101 ok, but I guess we can assume that their native functionality works, right?

@AayushSaini101
Copy link
Contributor Author

@AayushSaini101 ok, but I guess we can assume that their native functionality works, right?

yes, we have to check only for the /vote command.

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

added some comments to the action

please add to the action also proper logs that inform that:

  • user xxx is tsc member
    or
  • user xxx is not a tsc member

@@ -0,0 +1,44 @@
name: Verify Member
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
name: Verify Member
name: Verify TSC Member

Copy link
Member

Choose a reason for hiding this comment

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

also please change the folder name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @derberg

name: Verify Member
outputs:
isTSCMember:
description: 'Verify Member'
Copy link
Member

Choose a reason for hiding this comment

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

I guess we should specify it is true/false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done @derberg

value: ${{steps.verify_member.outputs.isTSCMember}}
inputs:
authorName:
description: 'Name of the Author'
Copy link
Member

Choose a reason for hiding this comment

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

actually github handle not the author name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @derberg change the description

using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

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

use latest version please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @derberg

uses: actions/checkout@v2

- name: Install the dependencies
run: npm install js-yaml
Copy link
Member

Choose a reason for hiding this comment

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

please install by specifying version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @derberg


- name: Verify TSC Member
id: verify_member
uses: actions/github-script@v6
Copy link
Member

Choose a reason for hiding this comment

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

I think latest is v7

Copy link
Contributor Author

@AayushSaini101 AayushSaini101 Apr 4, 2024

Choose a reason for hiding this comment

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

Done @derberg

// Load YAML file
const data = yaml.load(fs.readFileSync('MAINTAINERS.yaml', 'utf8'));
// Iterate over each person object
data.forEach(person => {
Copy link
Member

Choose a reason for hiding this comment

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

chat gpt can give you a better alternative with .filter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @derberg

// Iterate over each person object
data.forEach(person => {
// Check if the person is a TSC member or not
if (person.isTscMember && person.github == commenterName) {
Copy link
Member

Choose a reason for hiding this comment

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

person.isTscMember - we cannot assume we always get boolean, can be that true or false is a string, and then this will always return true, even if "false"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @derberg Added condition more

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

on implementation side, all looks good - just please provide an example that the vote-verification workflow works

I will do detailed docs review now

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

left few comments related to docs

removed screenshots as in such cases they are risky and take time to maintain - you can see they are for example already outdated for our case.

if you think they were useful, then better maybe link to some example PR from other project where it was used - as a side note - cncf/toc#1263 (comment)

voting.md Outdated Show resolved Hide resolved
voting.md Outdated Show resolved Hide resolved
voting.md Outdated Show resolved Hide resolved
voting.md Outdated Show resolved Hide resolved
.gitvote.yml Show resolved Hide resolved
AayushSaini101 and others added 6 commits April 8, 2024 21:54
Co-authored-by: Lukasz Gornicki <[email protected]>
Co-authored-by: Lukasz Gornicki <[email protected]>
Co-authored-by: Lukasz Gornicki <[email protected]>
Co-authored-by: Lukasz Gornicki <[email protected]>
Co-authored-by: Lukasz Gornicki <[email protected]>
@AayushSaini101
Copy link
Contributor Author

AayushSaini101/Vote#52 Testing of the changes

@AayushSaini101
Copy link
Contributor Author

left few comments related to docs

removed screenshots as in such cases they are risky and take time to maintain - you can see they are for example already outdated for our case.

if you think they were useful, then better maybe link to some example PR from other project where it was used - as a side note - cncf/toc#1263 (comment)
Yes, we can ignore screenshots the documentation is simple and easy to read

@AayushSaini101 AayushSaini101 requested a review from derberg April 9, 2024 07:01
Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

@AayushSaini101 lgtm

now, I have the following proposal

because with this PR we are not only adding automation, but we also change the way voting works (excluding discussions for example)

this means we need to ask TSC if they approve

and this means we could ask for vote and actually test how voting works at the same time

my proposal:

  • split this PR in 2
  • pr A only with GH actions and gitvote config. We merge without asking anyone - so we have it in master ready for final test
  • pr B with documentation only. once A is merged, I put a vote comment with explanation about what are we voting on

thoughts?

@derberg
Copy link
Member

derberg commented Apr 9, 2024

ah, and if you agree, please treat this pr as pr A - so just remove voting.md that you will upload in a separate PR

@AayushSaini101
Copy link
Contributor Author

ah, and if you agree, please treat this pr as pr A - so just remove voting.md that you will upload in a separate PR

@derberg Sounds good, Let's check :)

@AayushSaini101
Copy link
Contributor Author

ah, and if you agree, please treat this pr as pr A - so just remove voting.md that you will upload in a separate PR

@derberg File removed,

@derberg
Copy link
Member

derberg commented Apr 9, 2024

LGTM

for anyone looking at this one - we merge without asking for approval as this is they only way to test - any changes will later be applied through another PR that will be used for voting and also testing automation

/rtm

@asyncapi-bot asyncapi-bot merged commit bc65cc3 into asyncapi:master Apr 9, 2024
8 checks passed
@aeworxet
Copy link
Contributor

@asyncapi/bounty_team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

Integrate git-vote to get better automation around TSC voting and easy to calculate participation
4 participants