-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c1e69a
commit 5b0c743
Showing
3 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Add label to PR on comment | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Get the comment body | ||
id: get_comment_body | ||
run: | | ||
echo "Comment body: ${{ github.event.comment.body }}" | ls | ||
- name: Verify TSC Member | ||
id: verify_member | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const filePath = 'TSC_MEMBERS.json'; | ||
const commenterName = context.payload.sender.login; | ||
let isTSCMember = false; | ||
function readFileAndProcess(callback) { | ||
fs.readFile(filePath, 'utf8', (err, data) => { | ||
if (err) { | ||
callback(err, null); | ||
return; | ||
} | ||
try { | ||
const jsonData = JSON.parse(data); | ||
// Iterate over each object in the array | ||
jsonData.forEach(item => { | ||
if (item.github === commenterName) { | ||
isTSCMember = true; | ||
} | ||
}); | ||
// Invoke the callback function with the result | ||
callback(null, isTSCMember); | ||
} catch (parseError) { | ||
callback(parseError, null); | ||
} | ||
}); | ||
} | ||
readFileAndProcess((error, result) => { | ||
if (error) { | ||
console.error('Error:', error); | ||
} else { | ||
console.log('Is TSC Member:', result); | ||
core.setOutput('isTSCMember', isTSCMember); | ||
} | ||
}); | ||
- name: Add the label | ||
if: contains(github.event.comment.body, '/vote') && steps.verify_member.outputs.isTSCMember =='true' | ||
run: | ||
if [ "${{ github.event_name }}" = "pull_request" ]; then | ||
gh pr edit ${{ github.event.pull_request.number }} --add-label "vote" | ||
else | ||
gh issue edit ${{ github.event.issue.number }} --add-label "vote" | ||
fi | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Remove vote label | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Get the comment body | ||
id: get_comment_body | ||
run: | | ||
echo "Comment body: ${{ github.event.comment.body }}" | ||
- name: Verify TSC Member | ||
id: verify_member | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const filePath = 'TSC_MEMBERS.json'; | ||
const commenterName = context.payload.sender.login; | ||
let isTSCMember = false; | ||
function readFileAndProcess(callback) { | ||
fs.readFile(filePath, 'utf8', (err, data) => { | ||
if (err) { | ||
callback(err, null); | ||
return; | ||
} | ||
try { | ||
const jsonData = JSON.parse(data); | ||
// Iterate over each object in the array | ||
jsonData.forEach(item => { | ||
if (item.github === commenterName) { | ||
isTSCMember = true; | ||
} | ||
}); | ||
// Invoke the callback function with the result | ||
callback(null, isTSCMember); | ||
} catch (parseError) { | ||
callback(parseError, null); | ||
} | ||
}); | ||
} | ||
readFileAndProcess((error, result) => { | ||
if (error) { | ||
console.error('Error:', error); | ||
} else { | ||
console.log('Is TSC Member:', result); | ||
core.setOutput('isTSCMember', isTSCMember); | ||
} | ||
}); | ||
- name: Add the label | ||
if: contains(github.event.comment.body, '/cancel-vote') && steps.verify_member.outputs.isTSCMember =='true' | ||
run: | ||
run:| | ||
if [ "${{ github.event_name }}" = "pull_request" ]; then | ||
gh pr edit ${{ github.event.pull_request.number }} --remove-label "vote" | ||
else | ||
gh issue edit ${{ github.event.issue.number }} --remove-label "vote" | ||
fi | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
profiles: | ||
default: | ||
duration: 2m | ||
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 |