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

[#80] Github Actions 생성 (브랜치 체크) #122

Closed
wants to merge 3 commits into from
Closed

Conversation

chichoc
Copy link
Collaborator

@chichoc chichoc commented Nov 24, 2024

🔗 Linked Issue #80

🙋‍ Summary (요약)

Github Actions 스크립트 작성

  • 브랜치명 제한
  • main 브랜치에 merge 금지

😎 Description (변경사항)

자잘한 작업이라 job을 구분하여 하나의 파일로 생성하였습니다.

브랜치명 제한

check-branch-name:
  runs-on: ubuntu-latest
  if: github.event_name == 'push'
  steps:
    - name: Check out code
      uses: actions/checkout@v2

    - name: Check branch name
      run: |
        branch_name=$(git rev-parse --abbrev-ref HEAD)
        if [[ ! $branch_name =~ ^(feat/[0-9]+|bug/[0-9]+|hotfix|chore|gh-pages)$ ]]; then
          echo "Error: Branch name must follow the pattern 'feat/[number]', 'bug/[number]', 'hotfix', or 'chore'. or 'gh-pages'."
          exit 1
        fi

main 브랜치에 merge 금지

prevent-main-merge:
  runs-on: ubuntu-latest
  if: github.event_name == 'pull_request'
  steps:
    - name: Prevent merge to main
      run: |
        base_branch=$(jq -r .pull_request.base.ref "$GITHUB_EVENT_PATH")
        if [[ $base_branch == "main" ]]; then
          echo "Error: Pull requests to the main branch are not allowed."
          exit 1
        fi

🔥 Trouble Shooting (해결된 문제 및 해결 과정)

🤔 Open Problem (미해결된 문제 혹은 고민사항)

@chichoc chichoc added the chore 사소한 작업 label Nov 24, 2024
@chichoc chichoc self-assigned this Nov 24, 2024
@chichoc chichoc requested a review from a team as a code owner November 24, 2024 17:45
@chichoc chichoc requested review from Honghyeonji and inhachoi and removed request for a team November 24, 2024 17:45
@chichoc chichoc closed this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore 사소한 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant