Skip to content

Commit e27c63b

Browse files
authored
Create daily-folder.yml
1 parent 6f21076 commit e27c63b

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/daily-folder.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Daily folder (KST midnight)
2+
3+
on:
4+
schedule:
5+
# KST 00:00 = UTC 15:00 (전날)
6+
- cron: '0 15 * * *'
7+
workflow_dispatch: {}
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
create_today_folder:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set timezone to Asia/Seoul
20+
run: |
21+
sudo timedatectl set-timezone Asia/Seoul
22+
date
23+
24+
- name: Create today's folder with subfolders
25+
id: mk
26+
run: |
27+
TODAY=$(date +'%Y-%m-%d') # 예: 2025-08-12
28+
ROOT_DIR="${TODAY}"
29+
30+
if [ -d "$ROOT_DIR" ]; then
31+
echo "Directory $ROOT_DIR already exists."
32+
echo "changed=false" >> $GITHUB_OUTPUT
33+
exit 0
34+
fi
35+
36+
mkdir -p "$ROOT_DIR/홍길동"
37+
mkdir -p "$ROOT_DIR/김춘식"
38+
39+
# 빈 폴더 커밋을 위해 .gitkeep 파일 추가
40+
touch "$ROOT_DIR/홍길동/.gitkeep"
41+
touch "$ROOT_DIR/김춘식/.gitkeep"
42+
43+
echo "Created $ROOT_DIR with subfolders."
44+
echo "TODAY=$TODAY" >> $GITHUB_ENV
45+
echo "changed=true" >> $GITHUB_OUTPUT
46+
47+
- name: Commit & push if changed
48+
if: steps.mk.outputs.changed == 'true'
49+
run: |
50+
git config user.name "github-actions[bot]"
51+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
52+
git add -A
53+
git commit -m "chore: create folder for ${TODAY:-$(date +'%Y-%m-%d')} with subfolders"
54+
git push

0 commit comments

Comments
 (0)