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

docs/#105/items 앱모듈 파일에 추가, 토큰 반복변경 방지 코드 (시험) #112

Merged
merged 4 commits into from
Feb 7, 2025

Conversation

jeonheena
Copy link
Collaborator

🔗 관련 이슈

#105 #109

📝작업 내용

이전에 만들었던 임시 items api를 넣었었는데, app.module.ts에 넣지 않았어서 스웨거에서 확인이 안되었습니다.
app.module.ts에 items module를 추가했습니다.

🔍 변경 사항

💬리뷰 요구사항 (선택사항)

@@ -37,7 +37,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN_DG1418 }}
password: ${{ secrets.GHCR_TOCKEN_HEENA }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 매번 PR마다 토큰이 각자의 토큰으로 바뀌는 것 같던데 이유가 있나요?

Copy link

@bluetree7878 bluetree7878 Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

원래 if 문으로 처리하려다가 그게 안 돼서 PR 올리기 전에 각자의 토큰으로 바꾸는 방식을 사용하셨다 합니다.

# GitHub Container Registry 로그인
- name: Login to ghcr
  uses: docker/login-action@v3
  with:
    registry: ghcr.io
    username: ${{ github.actor }}
    password: ${{ github.actor == 'bluetree7878' && secrets.bluetree7878_GHCR_TOKEN || secrets.rhehfl_ghcr_token }}

그래서 저희 또한 if문으로 처리하려다 실패해서 그냥 이런 식으로 사용하였는데요.
찾아보니까 yml 파일에선 if문을 쓸 때 if [[ ]] 이렇게 써야 하는 걸 이번에 알게 됐습니다.

따라서 이렇게 작성해볼 수 있겠습니다. 실제로 작동되는지 확인은 안 해봤지만 오류가 따로 안 나는 걸로 봐서는 시도 한 번 해보는 것도 좋겠습니다...

# 조건에 맞게 토큰 값을 설정하는 스텝
- name: Set ghcr token
  id: set-token
  run: |
    if [ "${{ github.actor }}" = "gwgw123" ]; then
      echo "TOKEN=${{ secrets.GHCR_TOKEN }}" >> $GITHUB_OUTPUT
    elif [ "${{ github.actor }}" = "dg1418" ]; then
      echo "TOKEN=${{ secrets.GHCR_TOKEN_DG1418 }}" >> $GITHUB_OUTPUT
    elif [ "${{ github.actor }}" = "JeonHeena" ]; then
      echo "TOKEN=${{ secrets.USERC_GHCR_TOCKEN_HEENA }}" >> $GITHUB_OUTPUT
    fi

# GitHub Container Registry 로그인
- name: Login to ghcr
  uses: docker/login-action@v3
  with:
    registry: ghcr.io
    username: ${{ github.actor }}
    password: ${{ steps.set-token.outputs.TOKEN }}

참고 사이트: Codebuild Buildspec.yml File 조건문 사용

Copy link
Collaborator

@dg1418 dg1418 Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 좋은 참고 감사합니다. ㅋㅋ 미루어 두었던 하드 코딩을 끝낼때가 되었군요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다!!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와 우 ! ! 제 발 ! !

@jeonheena jeonheena changed the title docs/#105/items 앱모듈 파일에 추가 docs/#105/items 앱모듈 파일에 추가, 토큰 반복변경 방지 코드 (시험) Feb 7, 2025
@jeonheena jeonheena merged commit b068eca into develop Feb 7, 2025
@jeonheena jeonheena added the docs 문서 수정 label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs 문서 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants