π‘ Add a button for DReps to become active again #808
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
name: Add labels to π Bug report issues | |
on: | |
issues: | |
types: [opened, edited] | |
permissions: | |
issues: write | |
contents: read | |
jobs: | |
apply-labels: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if issue is a "π Bug report" | |
id: check_is_bug_report | |
run: | | |
echo "## Checking if issue is a 'Feature idea'..." | |
if [[ "${{ github.event.issue.title }}" == "π "* ]]; then | |
echo "is_bug_report=true" >> $GITHUB_ENV | |
else | |
echo "is_bug_report=false" >> $GITHUB_ENV | |
fi | |
- name: Apply label based on feature area | |
if: ${{ env.is_bug_report == 'true' }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const areaMap = { | |
"Proposal Pillar": "π Proposal Pillar", | |
"Voting Pillar": "π³οΈ Voting Pillar", | |
"Delegation Pillar": "βοΈ Delegation Pillar", | |
"Wrapper": "π Wrapper", | |
"Other": "Other area", | |
"Not sure": "βUnknown area", | |
}; | |
const issueBody = context.payload.issue.body; | |
// Match the Area selected under the "### Area" header | |
const areaMatch = issueBody.match(/### Area\s*\n\s*(.*)\s*\n/); | |
const area = areaMatch ? areaMatch[1].trim() : null; | |
const labelToAdd = areaMap[area]; | |
if (labelToAdd) { | |
await github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: [labelToAdd], | |
}); | |
} |