Content Updater #11
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: Content | |
on: | |
workflow_dispatch: | |
jobs: | |
content-update: | |
name: Update Content | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout static-frame-www | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository }} | |
fetch-depth: 0 | |
- name: Checkout static-frame | |
uses: actions/checkout@v3 | |
with: | |
repository: 'static-frame/static-frame' | |
path: 'static-frame' # this is inside the static-frame-www repo | |
- uses: actions/setup-python@master | |
with: | |
python-version: '3.11' | |
- name: Build JSON files | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements-test-3_11.txt | |
export PYTHONPATH="${PYTHONPATH}:." | |
python3 doc/build_json.py --write --output ../site-static-frame/src/sf-api | |
working-directory: static-frame | |
- name: Remove static-frame | |
run: rm -rf static-frame | |
- name: Commit to Git | |
run: | | |
git diff --stat | |
git config user.email "[email protected]" | |
git config user.name "Content Auto Update" | |
git checkout -b content-auto-update-${GITHUB_RUN_ID} | |
git commit -m "content-auto-update-${GITHUB_RUN_ID}" -a | |
git push origin content-auto-update-${GITHUB_RUN_ID} | |
- name: Create Pull Request | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
PR_DATA=$(jq -n \ | |
--arg title "Content Auto Update ${GITHUB_RUN_ID}" \ | |
--arg body "--" \ | |
--arg head "content-auto-update-${GITHUB_RUN_ID}" \ | |
--arg base "main" \ | |
'{"title": $title, "body": $body, "head": $head, "base": $base}') | |
curl --location --request POST "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls" \ | |
--header "Authorization: token ${GITHUB_TOKEN}" \ | |
--header "Content-Type: application/json" \ | |
--data "$PR_DATA" | |