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

chore: PR close 시 merged 라벨 추가 및 기존 워크플로 픽스 #43

Merged
merged 18 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 13 additions & 4 deletions .github/workflows/develop_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
java-version: [ 17 ]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
Expand All @@ -22,12 +22,21 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: check
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

- name: LifeCycle check
run: |
./gradlew check
- name: SonarCloud scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info --stacktrace
19 changes: 19 additions & 0 deletions .github/workflows/issue_set_merged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Add 'merged' label to closed PR

on:
pull_request:
types:
- closed

jobs:
set_merged:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add 'merged' label to closed PR
run: gh issue edit "$PR_NUMBER" --add-label "merged"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Add PR to project as pending status
name: Add New PR to project as pending status

on:
pull_request:
types:
- opened

jobs:
track_pr:
set_pending:
runs-on: ubuntu-latest
steps:
# Github App을 사용하여 토큰 생성
- name: Generate token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_APP_PEM }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PEM }}

# Github CLI를 사용하여 프로젝트 ID 및 필드 정보를 조회 후 project_data.json 파일에 저장
- name: Get project data
Expand Down Expand Up @@ -79,23 +79,20 @@ jobs:
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
PENDING_OPTION_ID="${{ env.PENDING_OPTION_ID }}"

gh api graphql -f query='
mutation (
$project: ID!
$item: ID!
$status_field: ID!
$status_value: String!
) {
set_status: updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $status_field
value: {
singleSelectOptionId: $status_value
}
}) {
mutation ($project: ID!, $item: ID!, $status_field: ID!, $status_value: String!) {
updateProjectV2ItemFieldValue(
input: {
projectId: $project,
itemId: $item,
fieldId: $status_field,
value: {singleSelectOptionId: $status_value}
}
) {
projectV2Item {
id
}
}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=$PENDING_OPTION_ID --silent
}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=$PENDING_OPTION_ID --silent
24 changes: 20 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'io.spring.dependency-management' version '1.1.3'
id 'com.diffplug.spotless' version '6.11.0'
id 'jacoco'
id 'org.sonarqube' version '4.4.1.3373'
}

group = 'com.depromeet'
Expand Down Expand Up @@ -44,10 +45,6 @@ tasks.named('test') {
finalizedBy 'jacocoTestReport'
}

jacoco {
toolVersion = "0.8.8"
}

def jacocoDir = layout.buildDirectory.dir("reports/")

def QDomains = []
Expand All @@ -68,6 +65,25 @@ def jacocoExcludePatterns = [
"**/*Resolver*"
]

sonar {
properties {
property "sonar.projectKey", "depromeet_10mm-server"
property "sonar.organization", "depromeet-1"
property "sonar.host.url", "https://sonarcloud.io"
property 'sonar.sources', 'src'
property 'sonar.language', 'java'
property 'sonar.sourceEncoding', 'UTF-8'
property 'sonar.test.exclusions', jacocoExcludePatterns.toString()
property 'sonar.test.inclusions', '**/*Test.java'
property 'sonar.java.coveragePlugin', 'jacoco'
property 'sonar.coverage.jacoco.xmlReportPaths', jacocoDir.get().file("jacoco/index.xml").asFile
}
}

jacoco {
toolVersion = "0.8.8"
}

jacocoTestReport {
dependsOn test
reports {
Expand Down