Skip to content

Commit 1da9abf

Browse files
authored
Update GitHub Actions workflow for README updates
1 parent 3d1424d commit 1da9abf

1 file changed

Lines changed: 34 additions & 29 deletions

File tree

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
1-
name: Update readme # GitHub Actions 탭에서 확인할 수 있는 액션 이름
1+
# // .github/workflows/update-readme.yml
2+
name: Update readme
23

3-
on: # jobs가 실행되어야 하는 상황 정의
4+
on:
45
push:
5-
branches: [ "main" ] # main 브랜치에 push가 발생했을 때
6-
pull_request:
6+
branches: ["main"]
7+
workflow_dispatch:
78

89
permissions:
910
contents: write
1011

11-
jobs: # 실제 실행될 내용
12+
jobs:
1213
build:
13-
runs-on: ubuntu-latest # 빌드 환경
14+
runs-on: ubuntu-latest
15+
1416
steps:
15-
- uses: actions/checkout@v3 # checkout
16-
- name: Set up Python 3.10
17-
uses: actions/setup-python@v3 # setup-python
18-
with:
19-
python-version: "3.10" # 3.10버전 파이썬 사용
20-
- name: Install dependencies # 1) 스크립트에 필요한 dependency 설치
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install python-leetcode
24-
- name: Run update.py # 2) update.py 실행
25-
run: |
26-
python update.py
27-
- name: Commit changes # 3) 추가된 파일 commit
28-
run: |
29-
git config --global user.name 'Ori-Gui' # 유저명
30-
git config --global user.email 'dign552@naver.com' # 유저 이메일
31-
git add -A
32-
git commit -am "auto update README.md" # 커밋 메시지
33-
- name: Push changes # 4) 메인에 푸시
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
run: |
37-
git push
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python 3.10
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.10"
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
29+
- name: Run update.py
30+
run: |
31+
python update.py
32+
33+
- name: Commit changes
34+
run: |
35+
git config --global user.name "Ori-Gui"
36+
git config --global user.email "dign552@naver.com"
37+
git add README.md
38+
git diff --cached --quiet || git commit -m "auto update README.md"
39+
40+
- name: Push changes
41+
run: |
42+
git push

0 commit comments

Comments
 (0)