-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (110 loc) · 4.46 KB
/
link-post.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Link Post
on:
pull_request:
types: [opened]
branches:
- main
jobs:
extract-week-num:
runs-on: ubuntu-latest
outputs:
week: ${{ steps.extract.outputs.week }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Print Context
run: |
echo ${{ github.ref }}
echo ${{ github.ref_name }}
echo ${{ github.head_ref }}
echo ${{ github.action_status }}
echo ${{ github.event_name }}
echo ${{ github.event_path }}
- name: Read Week number from Branch
id: extract
run: |
cd ./script
echo "week=$(python get_week_number.py ${{ github.head_ref }})" >> $GITHUB_OUTPUT
- name: Print Week number
run: echo ${{ steps.extract.outputs.week }}
extract-chapter-info:
runs-on: ubuntu-latest
needs: extract-week-num
outputs:
info: ${{ steps.extract-chapter-json.outputs.info }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Print extract Week number
run: echo ${{ needs.extract-week-num.outputs.week }}
- name: Read chapter-info from JSON
id: extract-chapter-json
run: |
cd ./script
echo "info<<EOF" >> $GITHUB_OUTPUT
python read_json.py ./json/chapter.json ${{ needs.extract-week-num.outputs.week }} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Print chapter info
run: echo "${{ steps.extract-chapter-json.outputs.info }}"
link-comment:
runs-on: ubuntu-latest
needs: [extract-week-num, extract-chapter-info]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Print Week number and Chapter Info
run: |
echo ${{ needs.extract-week-num.outputs.week }}
echo "${{ needs.extract-chapter-info.outputs.info }}"
- name: Auto Comment on Pull Request
if: github.event_name == 'pull_request' && github.event.action == 'opened'
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pullRequestOpened: |
👋 @{{ author }} 님 안녕하세요!
Udemy - ["AWS Certified Solutions Architect Associate시험합격! 2025"](https://www.udemy.com/course/best-aws-certified-solutions-architect-associate)
**${{ needs.extract-week-num.outputs.week }} 주차**를 학습하셨네요!
해당 주차의 강의 목록을 알려드릴께요!
### 📚 ${{ needs.extract-week-num.outputs.week }} 주차 강의 목록
${{ needs.extract-chapter-info.outputs.info }}
### 📖 기록을 남겨주세요!
공부하면서 찾아본 자료가 있다면, 자신과 다른 사람이 다시 찾아볼 수 있도록 **아카이브 정보에 기록**을 남겨주세요!
- [Discussions 아카이브 정보](https://github.com/Udemy-kor/aws-saa/discussions/categories/%EC%95%84%EC%B9%B4%EC%9D%B4%EB%B8%8C-%EC%A0%95%EB%B3%B4)
강의를 들으시면서 궁금한 점이나 있으시면 언제든지
- [Discussions Q&A](https://github.com/Udemy-kor/aws-saa/discussions/categories/q-a)
- 단톡방에 질문을 남겨 주세요! 😊
create-and-add-label:
runs-on: ubuntu-latest
needs: [extract-week-num]
if: always()
steps:
- name: Create and Add Label
uses: actions/github-script@v5
with:
script: |
const labelName = '${{ needs.extract-week-num.outputs.week }} 주차';
const labelColor = 'ffffff'; // 라벨 색상을 HEX 코드로 설정
// 라벨이 존재하는지 확인
try {
await github.rest.issues.getLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: labelName
});
} catch (error) {
// 라벨이 존재하지 않으면 생성
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: labelName,
color: labelColor,
});
}
// 풀 리퀘스트에 라벨 추가
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [labelName, '진행 중']
});