[GRM] 난이도 2 / 폭탄 구현하기(2) / 45분 #58
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Readme | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
run-script: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r script/requirements.txt | |
- name: Check token | |
env: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
run: | | |
if [ -z "$ACCESS_TOKEN" ]; then | |
echo "TOKEN is not set" | |
else | |
echo "TOKEN is set" | |
fi | |
- name: Run python script | |
env: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
working-directory: ./script | |
run: python collector.py | |
- name: Check for changes in README.md | |
id: check_changes | |
run: | | |
if git diff --exit-code README.md; then | |
echo "no changes" | |
echo "changes=false" >> $GITHUB_ENV | |
else | |
echo "Changes detected" | |
echo "changes=true" >> $GITHUB_ENV | |
fi | |
- name: Commit and push changes | |
if: env.changes == 'true' | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add README.md | |
git commit -m "Update README.md" | |
git push |