Skip to content

Move Issue to In Progress Pipeline #15

Move Issue to In Progress Pipeline

Move Issue to In Progress Pipeline #15

name: Move Issue to In Progress Pipeline
on:
create:
branches:
- "**"
jobs:
filter-branch:
runs-on: ubuntu-latest
outputs:
continue: ${{ steps.filter.outputs.continue }} # 브랜치 이름 형식이 맞아 액션을 실행할지 여부
steps:
# 액션을 실행할 형식의 브랜치 이름을 필터링
# 예: feat/#1-branche-name, fix/#2-branch-name
- name: filter branch name
id: filter
run: |
branch_name="${{ github.ref_name }}" # 브랜치 이름 가져오기
regex='^[a-zA-Z]+/#[0-9]+-.*$' # 정규식: "[a-zA-Z]*/#[0-9]-*"
# 정규식에 맞지 않는 브랜치 이름이면 액션 종료
if [[ ! "$branch_name" =~ $regex ]]; then
echo "💬 액션을 실행할 브랜치 형식이 아니므로 액션을 종료합니다."
echo "continue=false" >> $GITHUB_OUTPUT
else
echo "continue=true" >> $GITHUB_OUTPUT
fi
move-issue-to-in-progress:
runs-on: ubuntu-latest
needs: filter-branch # filter-branch 액션을 성공적으로 실행했을 때만 실행
if: needs.filter-branch.outputs.continue == 'true' # filter-branch 액션이 true일 때만 실행
steps:
# 액션에 필요한 파일을 가져오기 위한 작업
- name: Checkout Action
uses: actions/checkout@v4 # https://github.com/actions/checkout
with:
token: ${{ secrets.GITHUB_TOKEN }} # Github Actions에서 사용하는 기본 토큰
fetch-depth: 1 # 가장 최근 커밋만 가져오기
sparse-checkout: .github/actions # 액션 디렉토리만 가져오기
# Node.js 환경 설정
- name: Setup Node.js Environment
uses: ./.github/actions/setup-node
# PR을 In Progress Pipeline으로 이동하는 작업
- name: Move to In Progress Pipeline
uses: ./.github/actions/zenhub-move-issue
with:
token: ${{ secrets.GITHUB_TOKEN }}
zenhub_token: ${{ secrets.ZENHUB_TOKEN }}
workspace_id: ${{ vars.ZENHUB_WORKSPACE_ID }} # https://github.com/ZenHubIO/API?tab=readme-ov-file#notes-1
pipeline_id: ${{ vars.ZENHUB_IN_PROGRESS_PIPELINE_ID }}