-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Changes from 7 commits
5b0c743
04c7047
2aa27ae
b5b28f6
d35401b
603a058
75a665f
bca1c04
d7e79fd
1be2132
bb074f5
eba881f
bc617e2
7c94980
369ac9a
ea9aeb8
e8443d0
b1ab7da
dd1fd13
8102647
ba2a965
3c618ba
7543ccc
28a66fe
494ac73
e93b988
c859699
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Verify Member | ||
outputs: | ||
isTSCMember: | ||
description: 'Verify Member' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we should specify it is true/false There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually github handle not the author name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @derberg change the description |
||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use latest version please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @derberg |
||
|
||
- name: Install the dependencies | ||
run: npm install js-yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please install by specifying version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @derberg |
||
shell: bash | ||
|
||
- name: Verify TSC Member | ||
id: verify_member | ||
uses: actions/github-script@v6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think latest is v7 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @derberg |
||
with: | ||
script: | | ||
const yaml = require('js-yaml'); | ||
const fs = require('fs'); | ||
const commenterName = '${{inputs.authorName}}'; | ||
let isTSCMember = false; | ||
try { | ||
// Load YAML file | ||
const data = yaml.load(fs.readFileSync('MAINTAINERS.yaml', 'utf8')); | ||
// Iterate over each person object | ||
data.forEach(person => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. chat gpt can give you a better alternative with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @derberg |
||
// Check if the person is a TSC member or not | ||
if (person.isTscMember && person.github == commenterName) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @derberg Added condition more |
||
isTSCMember = true; | ||
|
||
} | ||
}); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
core.setOutput('isTSCMember', isTSCMember); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Verification of the Vote | ||
on: | ||
issue_comment: | ||
types: [created] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. latest please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @derberg |
||
- name: Verify the person | ||
id: verify_member | ||
uses: ./.github/actions/verifyMember | ||
with: | ||
authorName: "${{github.event.comment.user.login}}" | ||
|
||
- name: Set Output to Environment Variable | ||
run: echo "IS_TSC_MEMBER=${{ steps.verify_member.outputs.isTSCMember }}" >> $GITHUB_ENV | ||
|
||
- name: Sending unauthorised Message | ||
if: (contains(github.event.comment.body, '/cancel-vote')) && env.IS_TSC_MEMBER == 'false' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const commentText = `❌ @${{github.actor}} is not authorised to execute vote command. | ||
These commands can only be used by TSC members of the [TSC Members](https://github.com/asyncapi/community/blob/master/TSC_MEMBERS.json).`; | ||
console.log(`❌ @${{github.actor}} made an unauthorized attempt to use a vote command.`); | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: commentText | ||
}) | ||
|
||
- name: Add the label | ||
if: (contains(github.event.comment.body, '/cancel-vote') || contains(github.event.comment.body, '/vote')) && env.IS_TSC_MEMBER =='true' | ||
run: | | ||
if [ "${{ github.event.comment.body }}" == "/cancel-vote" ]; then | ||
if [ "${{ github.event_name }}" != "pull_request" ]; then | ||
gh issue edit ${{ github.event.issue.number }} --remove-label "vote" | ||
else | ||
gh pr edit ${{ github.event.issue.number }} --remove-label "vote" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a new label thanks @derberg |
||
fi | ||
fi | ||
if [ "${{ github.event.comment.body }}" == "/vote" ]; then | ||
if [ "${{ github.event_name }}" != "pull_request" ]; then | ||
gh issue edit ${{ github.event.issue.number }} --add-label "vote" | ||
else | ||
gh pr edit ${{ github.event.issue.number }} --add-label "vote" | ||
fi | ||
fi | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
derberg marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
profiles: | ||
derberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
default: | ||
duration: 1d | ||
pass_threshold: 51 | ||
periodic_status_check: "1 week" | ||
AayushSaini101 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
allowed_voters: | ||
teams: | ||
- tsc_members |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
## Voting for TSC Members | ||
derberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
There are many situation in the open source contribution, when we need to take suggestion of all the organsiation members, whether the particular issue is required or not, or the changes is valid in the specific pull request. | ||
|
||
Now we can easily listen the suggestions of the members via **git-vot** bot. | ||
|
||
### Voting Rules | ||
|
||
* The voting will be done by only TSC Members. | ||
* The duration of the voting will be 1 day. | ||
* The vote will be passed when more than 50% voting are in favour. | ||
|
||
### How to vote on particular issue and pull request. | ||
|
||
You need to add only one command to start the voting process on the issue on in the particular PR. **Please not only TSC Members can participate in the voting process**. | ||
|
||
*A **vote label** will be added on the issue after starting of the voting process.* | ||
|
||
**Command:** | ||
|
||
``` | ||
/vote | ||
``` | ||
|
||
**TSC Member starting voting process:** | ||
|
||
![image](https://hackmd.io/_uploads/Sk_L-CWyR.png) | ||
|
||
|
||
**Reactions to participate in voting process** | ||
* In favor of the changes. 👍 | ||
* In against of the changes. 👎 | ||
* Abstain from the voting. 👀 | ||
|
||
|
||
**Example:** | ||
|
||
Member voted in the favor of the required changes | ||
|
||
![image](https://hackmd.io/_uploads/BybuXCZ1C.png) | ||
|
||
|
||
**Result:** | ||
|
||
|
||
![image](https://hackmd.io/_uploads/ByXBNRWJA.png) | ||
|
||
|
||
### Checking status of the vote | ||
If anyone wants to check the status of the vote can easily check by using following command: | ||
|
||
``` | ||
/check-vote | ||
``` | ||
**Status of the vote** | ||
|
||
![image](https://hackmd.io/_uploads/ry3dOLGJ0.png) | ||
|
||
### Invalid vote execution | ||
|
||
|
||
When unauthorised member tries to execute the /vote command, he or she will get a message related to unauthorised. | ||
|
||
**Starting unauthorised voting:** | ||
|
||
![image](https://hackmd.io/_uploads/BywW8AbkR.png) | ||
|
||
|
||
**Getting response for voting** | ||
![image](https://hackmd.io/_uploads/rkjnS0bkA.png) | ||
|
||
|
||
|
||
### Cancelling the vote | ||
|
||
TSC members can cancel the voting on the particular issue or PR, The cancelling vote removes the **vote** label from an issue. | ||
|
||
**Command:** | ||
``` | ||
cancel-vote | ||
``` | ||
|
||
**Cancelling vote status:** | ||
|
||
![image](https://hackmd.io/_uploads/rkhgYUzkC.png) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
-aayushmau5 | ||
-imabp | ||
-akshatnema | ||
-anandsunderraman | ||
-arjungarg07 | ||
-CameronRushton | ||
-dalelane | ||
-emilianozublena | ||
-fmvilas | ||
-GeraldLoeffler | ||
-jonaslagoni | ||
-KhudaDad414 | ||
-lbroudoux | ||
-m3lkior | ||
-derberg | ||
-magicmatatjahu | ||
-AceTheCreator | ||
-damaru-inc | ||
-mcturco | ||
-NektariosFifes | ||
-Pakisan | ||
-theschles | ||
-pratik2315 | ||
-rcoppen | ||
-smoya | ||
-Souvikns | ||
-alequetzalli | ||
-BOLT04 | ||
-dan-r | ||
-KieranM1999 | ||
-JEFFLUFC | ||
-thulieblack | ||
-lewis-relph | ||
-boyney123 | ||
-Tenischev | ||
-Samridhi-98 | ||
-ron-debajyoti | ||
-ivangsa | ||
-Florence-Njeri | ||
-whitlockjc | ||
-char0n | ||
-VisualBean | ||
-Barbanio | ||
-kennethaasan | ||
-GreenRover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done @derberg