Skip to content

リアクションのアイコンを小さくする #375

リアクションのアイコンを小さくする

リアクションのアイコンを小さくする #375

name: Automatically labeling pull request.
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
auto-change-pr:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_ASSIGNEE: ${{ github.event.pull_request.user.login }}
PR_BRANCH: ${{ github.event.pull_request.head.ref }}
steps:
- uses: actions/checkout@v2
# 変更されたファイルを取得
- name: get changed files
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
frontend:
- 'view-user/**'
- 'view-admin/**'
backend:
- 'api/**'
- 'hasura/**'
infra:
- 'docker-compose.*'
- '**/*Dockerfile'
# ブランチ名からラベル名を取得
- uses: actions/github-script@v6
id: label_name
with:
github-token: ${{ env.GH_TOKEN }}
script: |
const env = process.env;
const branchType = env.PR_BRANCH.split('/')[0]
const branchTypeToLabel = {
feature: 'enhancement',
fix: 'bug',
hotfix: 'bug',
};
core.setOutput('label_name', branchTypeToLabel[branchType] || '')
# PRにラベルを付与
- name: Auto frontend labeling
if: steps.changes.outputs.frontend == 'true'
run: gh pr edit ${{ env.PR_NUMBER }} --add-label frontend
- name: Auto backend labeling
if: steps.changes.outputs.backend == 'true'
run: gh pr edit ${{ env.PR_NUMBER }} --add-label backend
- name: Auto infra labeling
if: steps.changes.outputs.infra == 'true'
run: gh pr edit ${{ env.PR_NUMBER }} --add-label infra
- name: Auto labeling
if: steps.label_name.outputs.label_name
run: gh pr edit ${{ env.PR_NUMBER }} --add-label ${{ steps.label_name.outputs.label_name }}
# PRにAssigneeを付与
- name: Auto assignee
if: toJSON(github.event.pull_request.assignees) == '[]'
run: gh pr edit ${{ env.PR_NUMBER }} --add-assignee ${{ env.PR_ASSIGNEE }}