Skip to content

Sync files from source repo #104

Sync files from source repo

Sync files from source repo #104

Workflow file for this run

name: Extract HTML Info
on:
push:
branches: [ gh-pages ]
paths:
- '**.html'
jobs:
extract-info:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Check Commit Message
id: check_msg
run: |
commit_msg=$(git log --format=%B -n 1)
if [[ "$commit_msg" == "Sync files from source repo" ]]; then
echo "::set-output name=run_job::true"
else
echo "::set-output name=run_job::false"
fi
- name: Set up Python
uses: actions/setup-python@v2
if: steps.check_msg.outputs.run_job == 'true'
with:
python-version: '3.x'
- name: Install Dependencies
if: steps.check_msg.outputs.run_job == 'true'
run: |
python -m pip install --upgrade pip
pip install beautifulsoup4
- name: Get Changed HTML Files
id: getfile
if: steps.check_msg.outputs.run_job == 'true'
run: |
changed_files=$(git diff --name-only HEAD~1 HEAD | grep '\.html')
echo "::set-output name=file::$changed_files"
- name: Extract Info from HTML Files
if: steps.check_msg.outputs.run_job == 'true'
run: |
for file in ${{ steps.getfile.outputs.file }}
do
python extract_info.py $file
done
- name: Commit and Push New File
if: steps.check_msg.outputs.run_job == 'true'
run: |
git config user.name "GitHub Action"
git config user.email "[email protected]"
git add .
git commit -m "Add new HTML file" || echo "No changes to commit"
git push -f origin gh-pages