Skip to content

Update index.yaml

Update index.yaml #61

Workflow file for this run

# This is a workflow for modifying and generating files based on changes to other files
name: File modifier
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Setup git
run: |
git config --local user.email "bot@twinbase.org"
git config --local user.name "twinbase-bot"
- name: Install python dependencies
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt
- name: Modify twindocs
run: |
# Create modification lists
git diff --name-only HEAD~1 HEAD | grep 'index.json' > modified-jsons.txt || echo "git exit code for jsons: $?"
git diff --name-only HEAD~1 HEAD | grep 'index.yaml' > modified-yamls.txt || echo "git exit code for yamls: $?"
# Update twindocs
python3 ${GITHUB_WORKSPACE}/.github/update-twindocs.py
# Remove modification lists
rm modified-yamls.txt
rm modified-jsons.txt
# Git operations
git add -A
git commit -m "Automodified twin documents" -a || echo "Warning: git commit returned error code $? (Hopefully nothing to commit)"
- name: Generate base YAML
run: |
cd docs/
python3 ${GITHUB_WORKSPACE}/.github/generate-base-yaml-json.py
cd ..
git add -A
git commit -m "Autogenerate base YAML and JSON" -a || echo "Warning: git commit returned error code $? (Hopefully nothing to commit)"
- name: Copy index.html to twin folders
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/script-copy-index-html.sh"
"${GITHUB_WORKSPACE}/.github/script-copy-index-html.sh"
git add -A
git commit -m "Autocopied from static/index.html" -a || echo "Warning: git commit returned error code $? (Hopefully nothing to commit)"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}