create actions #2
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 Progress Bar | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
update-progress-bar: | |
runs-on: ubuntu-latest | |
env: | |
BRANCH_NAME: ${{ github.ref_name }} | |
CHAPTER_NAME: 'chapter01' # ここを任意のchapter名に更新します | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
- name: Calculate progress | |
run: | | |
echo "PROGRESS=$(python .automation/calculate_progress.py $BRANCH_NAME $CHAPTER_NAME)" >> $GITHUB_ENV | |
- name: Generate progress bar | |
run: | | |
echo "# Progress" > progress.md | |
echo "" >> progress.md | |
echo "![](https://progress-bar.dev/$PROGRESS)" >> progress.md | |
- name: Commit progress bar | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add progress.md | |
git diff-index --quiet HEAD || git commit -m "Update progress bar" | |
git push |