Skip to content

minecraft changelog scraping #62

minecraft changelog scraping

minecraft changelog scraping #62

Workflow file for this run

name: 'minecraft changelog scraping'
on:
workflow_dispatch:
# schedule to run every day at 12:00
schedule:
- cron: '0 15,3 * * *' # JSTの0時(UTCの前日15時) JSTの12時(UTCの3時)
jobs:
run:
runs-on: ubuntu-latest
env:
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
GLOSSARY_ID: ${{ vars.GLOSSARY_ID }}
SCRAPING_LOG: ${{ vars.SCRAPING_LOG }}
SCRAPING_BETA_LOG: ${{ vars.SCRAPING_BETA_LOG }}
steps:
# Checkout the repository
- name: 'Checkout'
uses: actions/checkout@v4
# Setup Python
- name: 'Setup Python'
uses: actions/setup-python@v5
with:
python-version: '3.12.8'
# cache the virtual environment
- name: Cache virtual environment
id: cache-venv
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('requirements.txt') }}
# Install dependencies
- name: Set up virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
deactivate
# activate the virtual environment and check
- name: Activate virtual environment
run: |
source .venv/bin/activate
which python
pip list
deactivate
# run scraping_release.py
- name: Run scraping_release.py
run: |
source .venv/bin/activate
python scraping_release.py
deactivate
# run scraping_beta_and_preview.py
- name: Run scraping_beta_and_preview.py
run: |
source .venv/bin/activate
python scraping_beta_and_preview.py
deactivate
# set vars.SCRAPING_LOG
- name: Set vars.SCRAPING_LOG
if: ${{ hashFiles('scraping-release.log') != '' }}
run: |
gh variable set SCRAPING_LOG --body "$(cat scraping-release.log)"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
continue-on-error: true
# set vars.SCRAPING_BETA_LOG
- name: Set vars.SCRAPING_BETA_LOG
if: ${{ hashFiles('scraping-beta.log') != '' }}
run: |
gh variable set SCRAPING_BETA_LOG --body "$(cat scraping-beta.log)"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
continue-on-error: true
# show summary
- name: Show summary
run: |
echo "| name | status |" >> $GITHUB_STEP_SUMMARY
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
if [[ -f "scraping-release.log" ]]; then
RELEASE_LOG=$(cat scraping-release.log)
echo "| Release | ✅️ 通知しました: $RELEASE_LOG |" >> $GITHUB_STEP_SUMMARY
else
echo "| Release | ✅️ 新しい投稿はありません。 |" >> $GITHUB_STEP_SUMMARY
fi
if [[ -f "scraping-beta.log" ]]; then
BETA_LOG=$(cat scraping-beta.log)
echo "| Beta & Preview | ✅️ 通知しました: $BETA_LOG |" >> $GITHUB_STEP_SUMMARY
else
echo "| Beta & Preview | ✅️ 新しい投稿はありません。 |" >> $GITHUB_STEP_SUMMARY
fi
continue-on-error: true