Skip to content

Commit

Permalink
Added required changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSaini101 committed Mar 28, 2024
1 parent 5b0c743 commit 04c7047
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 189 deletions.
43 changes: 43 additions & 0 deletions .github/actions/verifyMember/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Verify Member
outputs:
isTSCMember:
description: 'Verify Member'
value: ${{steps.verify_member.outputs.isTSCMember}}
inputs:
authorName:
description: 'Name of the Author'
required: true

runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install the dependencies
run: npm install js-yaml
shell: bash

- name: Verify TSC Member
id: verify_member
uses: actions/github-script@v6
with:
script: |
const yaml = require('js-yaml');
const fs = require('fs');
const commenterName = 'AayushSaini101';
let isTSCMember = false;
try {
// Load YAML file
const data = yaml.load(fs.readFileSync('MAINTAINERS.yaml', 'utf8'));
// Iterate over each person object
data.forEach(person => {
// Check if the person is a TSC member or not
if (person.isTscMember && person.github == commenterName) {
isTSCMember = true;
core.setOutput('isTSCMember', isTSCMember);
}
});
} catch (e) {
console.log(e);
}
70 changes: 0 additions & 70 deletions .github/workflows/add_vote_label.yml

This file was deleted.

71 changes: 0 additions & 71 deletions .github/workflows/remove_vote_label.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/vote-verifcation.yml
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
- 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 authorised
if: (contains(github.event.comment.body, '/vote') || 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 authorized to vote.
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"
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 }}
50 changes: 2 additions & 48 deletions .gitvote.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,8 @@
profiles:
default:
duration: 2m
duration: 1d
pass_threshold: 51
periodic_status_check: "1 week"
allowed_voters:
teams:
- tsc_members
users:
- 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
- tsc_members
85 changes: 85 additions & 0 deletions docs/voting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
## Voting for TSC Members

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)
Loading

0 comments on commit 04c7047

Please sign in to comment.