π CORS erros on DRep profile #799
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 π‘ Feature idea 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 "π‘ Feature idea" | |
id: check_is_feature_idea | |
run: | | |
echo "## Checking if issue is a 'Feature idea'..." | |
if [[ "${{ github.event.issue.title }}" == "π‘ "* ]]; then | |
echo "is_feature_idea=true" >> $GITHUB_ENV | |
else | |
echo "is_feature_idea=false" >> $GITHUB_ENV | |
fi | |
- name: Apply label based on feature area | |
if: ${{ env.is_feature_idea == '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], | |
}); | |
} | |
- name: Apply "π¨ Design Needed" label if design needed is "Yes" | |
if: ${{ env.is_feature_idea == 'true' }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const issueBody = context.payload.issue.body; | |
// Match the "Yes" selection under the "### Is there new design needed?" header | |
const designNeededMatch = issueBody.match(/### Is there new design needed\?\s*\n\s*Yes\s*\n/); | |
if (designNeededMatch) { | |
await github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["π¨ Design Needed"], | |
}); | |
} | |
- name: Apply "User Story Needed" label if user story not provided | |
if: ${{ env.is_feature_idea == 'true' }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const issueBody = context.payload.issue.body; | |
const userStoryPattern = /### \(Optional\) User Story with acceptance criteria\s*\n\s*_No response_/; | |
const userStoryMissing = userStoryPattern.test(issueBody); | |
if (userStoryMissing) { | |
await github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["User Story Needed"], | |
}); | |
} |