Merge pull request #2429 from farid-zare/masterWorkFlow #1
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: Extract HTML Info | |
on: | |
push: | |
branches: [develop] | |
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 "run_job=true" >> $GITHUB_OUTPUT | |
else | |
echo "run_job=false" >> $GITHUB_OUTPUT | |
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 and update the index.html file of tutorial | |
id: getfile | |
if: steps.check_msg.outputs.run_job == 'true' | |
run: | | |
changed_files=$(git diff --name-only HEAD~1 HEAD | grep '\.html' | tr '\n' ' ') | |
for file in $changed_files; do | |
echo "Processing: $file" | |
python ./docs/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-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Update Tutorial (Automatic Workflow)" || echo "No changes to commit" | |
git push origin master |