Update OpenAPI File #260
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 OpenAPI File | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
update-openapi-file: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # 'write' access to repository contents | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-root | |
- name: Update File | |
run: poetry run python maplestory/check_update.py | |
- name: Check updated file existence | |
id: check_files | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: updated_files.txt | |
- name: File exists | |
if: steps.check_files.outputs.files_exists == 'true' | |
run: echo All files exists! | |
- name: Commit files | |
if: steps.check_files.outputs.files_exists == 'true' | |
run: | | |
git config --global user.name "Jangwon Seo" | |
git config --global user.email "nanpuhaha@gmail.com" | |
git add -u | |
git reset -- updated_files.txt | |
git commit -a -m "🌱 Update OpenAPI files via GitHub Actions" | |
- name: Push changes | |
if: steps.check_files.outputs.files_exists == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.TOKEN }} | |
branch: ${{ github.ref }} |