Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

特定のディレクトリ配下での変更があった場合に関連するissueに特定のlabelを付与したい。 #80 #81

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
20 changes: 0 additions & 20 deletions .github/workflows/.github-ci.yml
Expand Up @@ -25,16 +25,6 @@ jobs:
run: sudo cp spec/support/capybara-ci.rb.example spec/support/capybara.rb
- name: run spec
run: bundle exec rspec
- name: Slack Notification
uses: lazy-actions/slatify@master
if: always()
with:
type: ${{ job.status }}
job_name: 'RSpec'
url: ${{ secrets.SLACK_WEBHOOK }}
icon_emoji: ":robot_face:"
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
rubocop:
runs-on: ubuntu-latest
container:
Expand All @@ -45,13 +35,3 @@ jobs:
run: bundle install
- name: run rubocop
run: bundle exec rubocop
- name: Slack Notification
uses: lazy-actions/slatify@master
if: always()
with:
type: ${{ job.status }}
job_name: 'Rubocop'
url: ${{ secrets.SLACK_WEBHOOK }}
icon_emoji: ":robot_face:"
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/add_label.yml
@@ -0,0 +1,51 @@
name: Add Label
on:
pull_request:

jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set issue number
run: |
issue_number=$(echo ${{github.head_ref}} | grep -o "[0-9]\+")
echo "ISSUE_NUMBER=${issue_number}" >> $GITHUB_ENV
- name: Get chnaged files
uses: tj-actions/changed-files@v37
id: changed-files
with:
files_yaml: |
task:
- lib/tasks/**
- name: Add label
uses: actions/github-script@v6
if: steps.changed-files.outputs.task_any_changed == 'true'
env:
ISSUE_NUMBER: ${{ env.ISSUE_NUMBER }}
with:
script: |
const { ISSUE_NUMBER } = process.env
github.rest.issues.addLabels({
issue_number: ISSUE_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['task']
})
- name: Remove label
uses: actions/github-script@v6
if: steps.changed-files.outputs.task_any_changed == 'false'
env:
ISSUE_NUMBER: ${{ env.ISSUE_NUMBER }}
with:
script: |
const { ISSUE_NUMBER } = process.env
github.rest.issues.removeLabel({
issue_number: ISSUE_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'task'
})
5 changes: 5 additions & 0 deletions lib/tasks/greet.rake
Expand Up @@ -5,4 +5,9 @@ namespace :greet do
task task_test: :environment do
puts 'hello'
end

desc 'テスト2'
task task_test2: :environment do
puts 'hello2'
end
end