Fetch Remote Assets #46
Workflow file for this run
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: Fetch Remote Assets | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '00 01 * * *' # Should run 1 hour after module list update. | |
env: | |
MODULES_LIST_URL: "https://raw.githubusercontent.com/nesi/modules-list/main/module-list.json" | |
GLOSSARY_URL: "https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/glossary.md" | |
DICTIONARY_URL: "https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/dictionary.txt" | |
SNIPPETS_URL: "https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/snippets.md" | |
BRANCH_NAME: "assets-update" | |
jobs: | |
fetch-includes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Set Up Env" | |
uses: actions/checkout@v4 | |
- run: | | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git pull origin ${GITHUB_REF} | |
git checkout -b $(date +'%Y-%m-%d')-${BRANCH_NAME} | |
mkdir -pv docs/assets/glossary | |
- name: Fetch Module List | |
run: wget -O docs/assets/module-list.json ${MODULES_LIST_URL} | |
- name: Link apps pages | |
run: python3 .github/workflows/link_apps_pages.py | |
- name: Fetch Glossary | |
run: wget -O overrides/partials/glossary.html ${GLOSSARY_URL} | |
- name: Fetch Dictionary | |
run: wget -O docs/assets/glossary/dictionary.txt ${DICTIONARY_URL} | |
- name: Fetch Snippets | |
run: wget -O docs/assets/glossary/snippets.md ${SNIPPETS_URL} | |
- name: Commit to Branch | |
id: commit | |
run: | | |
git add --all | |
set +e | |
git commit -m "Add updated remote assets" | |
echo 'change=$()' >> $GITHUB_OUTPUT | |
set -e | |
- name: Push, and make PR | |
if: ${{ steps.commit.outputs.change != 1 }} | |
run: | | |
echo "last job ${{ steps.commit.outputs.change }}" | |
git push origin $(date +'%Y-%m-%d')-${BRANCH_NAME} | |
gh pr create -B ${GITHUB_REF} -H $(date +'%Y-%m-%d')-${BRANCH_NAME} --title 'Update Remote Assets' --body 'Created by Github action' | |
gh pr merge $(date +'%Y-%m-%d')-${BRANCH_NAME} --squash --auto --delete-branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |