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 머지 시 자동으로 관련 이슈 닫는 스크립트 구현 #186

Closed
wants to merge 3 commits into from
Closed
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
20 changes: 20 additions & 0 deletions .github/workflows/auto-close-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Auto Close Issues on Merge

on:
pull_request:
types: [opened] # closed로 바꾸기

jobs:
close-related-issue:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.base.ref != 'main'
steps:
- name: Extract and Close Issue
run: |
PR_BODY="${{ github.event.pull_request.body }}"
ISSUE_NUMBERS=$(echo $PR_BODY | grep -oP 'close #\d+' | awk '{print substr($2, 2)}')
for ISSUE_NUMBER in $ISSUE_NUMBERS; do
gh api -X PATCH /repos/${{ github.repository }}/issues/$ISSUE_NUMBER --field state=closed
done
env:
GITHUB_TOKEN: ${{ secrets.AUTO_CLOSE_GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion backend/http/offering.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
GET {{base-url}}/offerings/1

### 공모 목록 조회 API
GET {{base-url}}/offerings?filter=RECENT&search=&last-id=99&page-size=2
GET {{base-url}}/offerings

### 공모 필터 목록 조회 API
GET {{base-url}}/offerings/filters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public interface OfferingRepository extends JpaRepository<OfferingEntity, Long>
@Query("""
SELECT o
FROM OfferingEntity o
WHERE o.id < :lastId AND (o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%)
WHERE o.id < :lastId
AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%)
ORDER BY o.id DESC
""")
List<OfferingEntity> findRecentOfferingsWithKeyword(Long lastId, String keyword, Pageable pageable);
Expand All @@ -31,7 +32,7 @@ public interface OfferingRepository extends JpaRepository<OfferingEntity, Long>
SELECT o
FROM OfferingEntity o
WHERE (o.deadline > :lastDeadline OR (o.deadline = :lastDeadline AND o.id < :lastId))
AND (o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%)
AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%)
ORDER BY o.deadline ASC, o.id DESC
""")
List<OfferingEntity> findImminentOfferingsWithKeyword(
Expand All @@ -42,7 +43,7 @@ List<OfferingEntity> findImminentOfferingsWithKeyword(
FROM OfferingEntity o
WHERE ((o.eachPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.eachPrice < :discountRate
OR ((o.eachPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.eachPrice = :discountRate AND o.id < :lastId))
AND (o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%)
AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%)
ORDER BY (o.eachPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.eachPrice DESC, o.id DESC
""")
List<OfferingEntity> findHighDiscountOfferingsWithKeyword(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ class GetAllOffering {

List<ParameterDescriptorWithType> queryParameterDescriptors = List.of(
parameterWithName("filter").description("필터 이름 (기본값: RECENT)"
+ getEnumValuesAsString(OfferingFilter.class)),
parameterWithName("search").description("검색어"),
parameterWithName("last-id").description("마지막 공모 id"),
parameterWithName("page-size").description("페이지 크기 (기본값: 10)")
+ getEnumValuesAsString(OfferingFilter.class)).optional(),
parameterWithName("search").description("검색어").optional(),
parameterWithName("last-id").description("마지막 공모 id").optional(),
parameterWithName("page-size").description("페이지 크기 (기본값: 10)").optional()
);
List<FieldDescriptor> successResponseDescriptors = List.of(
fieldWithPath("offerings[].id").description("공모 id"),
Expand Down