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

Update a variables and notification emoji #14

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions .github/workflows/cr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,30 @@ permissions:
pull-requests: write

env:
webhook_url: ${{ secrets.WEBHOOK }}
WEBHOOK_URL: ${{ secrets.WEBHOOK }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
test:
code_review:
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
MODEL: gpt-3.5-turbo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_KEY: ${{ env.OPENAI_API_KEY }}
LANGUAGE: Korean

- name: notification to swit
uses: roharon/action-swit@v1
with:
webhooks_url: ${{ env.webhook_url }}
MESSAGE: "🏷 ${{ job.status }} 백엔드 OpenAI 코드 리뷰 : Core-service - by ${{ github.actor }}"

- name: Send Notification
if: ${{ always() }}
run: |
if [[ ${{ job.status }} == "success" ]]; then
MESSAGE="✅ ${{ job.status }} 백엔드 OpenAI 코드 리뷰 성공: core-service - by ${{ github.actor }}"
else
MESSAGE="❌ ${{ job.status }} 백엔드 OpenAI 코드 리뷰 실패: core-service - by ${{ github.actor }}"
fi
Taein2 marked this conversation as resolved.
Show resolved Hide resolved
curl -X POST -H "Content-Type: application/json" --data "{\"text\":\"${MESSAGE}\"}" ${{ env.WEBHOOK_URL }}
37 changes: 17 additions & 20 deletions .github/workflows/ecr.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ "main" ]

env:
ecr_url: ${{ secrets.ECR_REPO_DEV }}
role_arn: ${{ secrets.OIDC_ROLE }}
aws_region: ${{ secrets.AWS_REGION }}
webhook_url: ${{ secrets.WEBHOOK }}
ECR_URL: ${{ secrets.ECR_REPO_DEV }}
ROLE_ARN: ${{ secrets.OIDC_ROLE }}
AWS_REGION: ${{ secrets.AWS_REGION }}
WEBHOOK_URL: ${{ secrets.WEBHOOK }}

permissions:
id-token: write
Expand Down Expand Up @@ -55,21 +48,25 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.aws_region }}
aws-region: ${{ env.AWS_REGION }}
role-session-name: GitHubActions
role-to-assume: ${{ env.role_arn }}
role-to-assume: ${{ env.ROLE_ARN }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Publish Image to ECR(CORE-SERVICE)
run: |
docker tag core-service:latest ${{ env.ecr_url }}:core-service
docker push ${{ env.ecr_url }}:core-service
docker tag core-service:latest ${{ env.ECR_URL }}:core-service
docker push ${{ env.ECR_URL }}:core-service

- name: notification to swit
uses: roharon/action-swit@v1
with:
webhooks_url: ${{ env.webhook_url }}
MESSAGE: "🏷 ${{ job.status }} 백엔드 ECR 도커파일 업로드 : Core-service - by ${{ github.actor }}"
- name: Send Notification
if: ${{ always() }}
run: |
if [[ ${{ job.status }} == "success" ]]; then
MESSAGE="✅ ${{ job.status }} 백엔드 ECR 도커파일 업로드 성공: core-service - by ${{ github.actor }}"
else
MESSAGE="❌ ${{ job.status }} 백엔드 ECR 도커파일 업로드 실패: core-service - by ${{ github.actor }}"
fi
curl -X POST -H "Content-Type: application/json" --data "{\"text\":\"${MESSAGE}\"}" ${{ env.WEBHOOK_URL }}
Taein2 marked this conversation as resolved.
Show resolved Hide resolved
Taein2 marked this conversation as resolved.
Show resolved Hide resolved
36 changes: 19 additions & 17 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ on:
branches: [ main ]

env:
ecr_url: ${{ secrets.ECR_REPO_DEV }}
role_arn: ${{ secrets.OIDC_ROLE }}
aws_region: ${{ secrets.AWS_REGION }}
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
default_output: ${{ secrets.AWS_DEFAULT_OUTPUT }}
webhook_url: ${{ secrets.WEBHOOK }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DEFAULT_OUTPUT: ${{ secrets.AWS_DEFAULT_OUTPUT }}
WEBHOOK_URL: ${{ secrets.WEBHOOK }}

permissions: write-all

jobs:
build:
test_pr:
name: Build and Test
runs-on: ubuntu-latest

Expand All @@ -31,10 +29,10 @@ jobs:

- name: Configure AWS credentials
run: |
aws configure set aws_access_key_id ${{ env.aws_access_key }}
aws configure set aws_secret_access_key ${{ env.aws_secret_key }}
aws configure set default.region ${{ env.aws_region }}
aws configure set default.output ${{ env.default_output }}
aws configure set aws_access_key_id ${{ env.AWS_ACCESS_KEY }}
aws configure set aws_secret_access_key ${{ env.AWS_SECRET_KEY }}
aws configure set default.region ${{ env.AWS_REGION }}
aws configure set default.output ${{ env.DEFAULT_OUTPUT }}

- name: Set up JDK 17
uses: actions/setup-java@v3
Expand All @@ -55,8 +53,12 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: build/test-results/**/*.xml

- name: notification to swit
uses: roharon/action-swit@v1
with:
webhooks_url: ${{ env.webhook_url }}
MESSAGE: "🏷 ${{ job.status }} 백엔드 Unit Test : Core-service - by ${{ github.actor }}"
- name: Send Notification
if: ${{ always() }}
run: |
if [[ ${{ job.status }} == "success" ]]; then
MESSAGE="✅ ${{ job.status }} 백엔드 Unit Test 성공: core-service - by ${{ github.actor }}"
else
MESSAGE="❌ ${{ job.status }} 백엔드 Unit Test 실패: core-service - by ${{ github.actor }}"
fi
Taein2 marked this conversation as resolved.
Show resolved Hide resolved
curl -X POST -H "Content-Type: application/json" --data "{\"text\":\"${MESSAGE}\"}" ${{ env.WEBHOOK_URL }}
Loading