[追加希望]: jiyuujin #27
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: want to write | |
on: | |
issues: | |
types: | |
- opened | |
jobs: | |
set-label: | |
name: Set label | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 1 | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.COMM_GITHUB_TOKEN }} | |
script: | | |
const issueTitle = context.payload.issue.title; | |
const labelsToAdd = []; | |
/** | |
* @typedef {Object} Label | |
* @property {string} regex - 検索文字列 | |
* @property {string} label - ラベル名 | |
*/ | |
/** @type {Label[]} */ | |
const labels = [ | |
{ regex: /Nuxt/i, label: 'Nuxt' }, | |
# TODO: 面倒くさかったので一旦。優先度は高くないので気が向いたら直す | |
{ regex: /Vue(.js)?/i, label: 'Vue.js' }, | |
{ regex: /UnJS/i, label: 'UnJS' } | |
]; | |
labels.forEach(label => { | |
if (label.regex.test(issueTitle)) { | |
console.log(`Math: ${label.label}`); | |
labelsToAdd.push(label.label); | |
} | |
}); | |
if (labelsToAdd.length > 0) { | |
github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
labels: labelsToAdd | |
}); | |
} | |
console.info(`title: ${issueTitle}, labels: ${labelsToAdd.join(',')}`); | |
# ref: https://github.com/shinGangan/.github/blob/main/.github/workflows/issue.yml | |
set-author: | |
if: ${{ contains(github.event.issue.labels.*.name, '🖐️ wish author') }} | |
permissions: | |
contents: read | |
issues: write | |
uses: shinGangan/.github/.github/workflows/issue.yml@main | |
with: | |
number: ${{ github.event.issue.number }} | |
assignee: ${{ github.actor }} | |
milestone: 'articles' | |
secrets: | |
token: ${{ secrets.COMM_GITHUB_TOKEN }} | |
repo: ${{ github.repository }} | |
set-comment: | |
name: Add management comment | |
if: ${{ contains(github.event.issue.labels.*.name, '🙏 please write') }} | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 1 | |
permissions: | |
issues: write | |
steps: | |
- run: | | |
gh issue edit -m 'articles' | |
gh issue comment $NUMBER -b '<h3>運営コメント</h3>執筆希望あれば @shinGangan をメンションしてください。アサインします。' | |
env: | |
NUMBER: ${{ inputs.number }} | |
GH_TOKEN: ${{ secrets.COMM_GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} |