Skip to content

Commit

Permalink
[ci]: Fix auto-labeling (#4276)
Browse files Browse the repository at this point in the history
Signed-off-by: Shunkichi Sato <49983831+s8sato@users.noreply.github.com>
  • Loading branch information
s8sato authored Feb 21, 2024
1 parent 64e9e31 commit effdf37
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 88 deletions.
17 changes: 17 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
iroha2:
- base-branch: '^iroha2.*$'

api-changes:
- all:
- base-branch: '^iroha2-dev$'
- changed-files:
- any-glob-to-any-file:
- 'docs/source/references/schema.json'
- 'torii/src/**'
- 'torii/const/src/**'

config-changes:
- all:
- base-branch: '^iroha2-dev$'
- changed-files:
- any-glob-to-any-file: 'configs/**'
36 changes: 0 additions & 36 deletions .github/workflows/iroha2-dev-pr-label.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/iroha2-dev-pr-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '**.rs'
- '**.json'
- '**.toml'
- '.github/workflows/**.yml'
- '.github/workflows/iroha2-dev-pr-static.yml'
- 'client_cli/pytests/**/*.py'

concurrency:
Expand Down
83 changes: 41 additions & 42 deletions .github/workflows/iroha2-dev-pr-title.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
name: I2::Dev::Title

on:
pull_request:
pull_request_target:
branches: [iroha2-dev]
types: [opened, edited, reopened]

jobs:
check:
runs-on: ubuntu-latest
# TODO: Add labels when https://github.com/actions/first-interaction/issues/10 is fixed.
steps:
- name: Feature
uses: actions-ecosystem/action-regex-match@v2
id: feature-match
with:
text: ${{ github.event.pull_request.title }}
regex: '^\[feature\] #\d+(, #\d+)*: .+$'
# - name: Add feature label
# uses: actions-ecosystem/action-add-labels@v1
# if: steps.feature-match.outputs.match != ''
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# Enhancement
- name: Add feature label
uses: actions-ecosystem/action-add-labels@v1
if: steps.feature-match.outputs.match != ''
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
labels: |
Enhancement
- name: Refactor
uses: actions-ecosystem/action-regex-match@v2
Expand All @@ -32,14 +31,14 @@ jobs:
with:
text: ${{ github.event.pull_request.title }}
regex: '^\[refactor\]( #\d+(, #\d+)*)?: .+$'
# - name: Add Refactor label
# uses: actions-ecosystem/action-add-labels@v1
# if: steps.refactor-match.outputs.match != ''
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# Refactor
- name: Add Refactor label
uses: actions-ecosystem/action-add-labels@v1
if: steps.refactor-match.outputs.match != ''
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
labels: |
Refactor
- name: Fix
uses: actions-ecosystem/action-regex-match@v2
Expand All @@ -48,14 +47,14 @@ jobs:
with:
text: ${{ github.event.pull_request.title }}
regex: '\[fix\] #\d+(, #\d+)*: .+$'
# - name: Add fix label
# uses: actions-ecosystem/action-add-labels@v1
# if: steps.fix-match.outputs.match != ''
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# Bug
- name: Add fix label
uses: actions-ecosystem/action-add-labels@v1
if: steps.fix-match.outputs.match != ''
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
labels: |
Bug
- name: Documentation
uses: actions-ecosystem/action-regex-match@v2
Expand All @@ -64,14 +63,14 @@ jobs:
with:
text: ${{ github.event.pull_request.title }}
regex: '^\[documentation\]( #\d+(, #\d+)*)?: .+$'
# - name: Add Documentation label
# uses: actions-ecosystem/action-add-labels@v1
# if: steps.docs-match.outputs.match != ''
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# Documentation
- name: Add Documentation label
uses: actions-ecosystem/action-add-labels@v1
if: steps.docs-match.outputs.match != ''
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
labels: |
Documentation
- name: CI
uses: actions-ecosystem/action-regex-match@v2
Expand All @@ -80,14 +79,14 @@ jobs:
with:
text: ${{ github.event.pull_request.title }}
regex: '^\[ci\]( #\d+(, #\d+)*)?: .+$'
# - name: Add CI label
# uses: actions-ecosystem/action-add-labels@v1
# if: steps.ci-match.outputs.match != ''
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# CI
- name: Add CI label
uses: actions-ecosystem/action-add-labels@v1
if: steps.ci-match.outputs.match != ''
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
labels: |
CI
- name: None of the above
if: steps.fix-match.outputs.match == '' && steps.refactor-match.outputs.match == '' && steps.feature-match.outputs.match == '' && steps.docs-match.outputs.match == '' && steps.ci-match.outputs.match == ''
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '**.rs'
- '**.json'
- '**.toml'
- '.github/workflows/**.yml'
- '.github/workflows/iroha2-dev-pr.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/iroha2-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ name: I2::Label

on:
pull_request_target:
branches: [iroha2-dev, iroha2-stable, iroha2-lts]
types: [opened]

jobs:
add:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.github_token }}
labels: |
iroha2
- id: label-the-PR
uses: actions/labeler@v5
with:
sync-labels: true
- uses: mshick/add-pr-comment@v2
if: contains(steps.label-the-PR.outputs.all-labels, 'config-changes')
with:
message: |
@BAStos525

0 comments on commit effdf37

Please sign in to comment.