Skip to content

Fetch Remote Assets #255

Fetch Remote Assets

Fetch Remote Assets #255

name: Fetch Remote Assets
on:
workflow_dispatch:
schedule:
- cron: '00 12 * * *' # 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
with:
fetch-depth: 0
- run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config pull.rebase true
# git checkout ${GITHUB_REF}
# git pull origin ${GITHUB_REF}
git branch -D ${BRANCH_NAME} || true
git checkout -b ${BRANCH_NAME}
mkdir -pv docs/assets/glossary
- name: Module List
run: |
wget -O docs/assets/module-list.json ${MODULES_LIST_URL}
python3 .github/workflows/link_apps_pages.py
git add --all
git commit -m "Updated Module List" || (echo "No Changes";exit 0)
- name: Fetch Wordlist
run: |
wget -O overrides/partials/glossary.html ${GLOSSARY_URL}
wget -O docs/assets/glossary/dictionary.txt ${DICTIONARY_URL}
wget -O docs/assets/glossary/snippets.md ${SNIPPETS_URL}
git add --all
git commit -m "Updated Glossary" || (echo "No Changes";exit 0)
- name: Commit to Branch
id: commit
run: |
body_message="This Merge Request was triggered by an update to $(git diff --name-only ${GITHUB_REF} | tr '\n' ', ')."
if [[ $(git log ${GITHUB_REF}..HEAD) ]]; then
git pull origin ${BRANCH_NAME}
git push origin ${BRANCH_NAME}
gh pr create -B ${GITHUB_REF} -H ${BRANCH_NAME} --title "Automatic Asset Update - $(date +'%Y-%m-%d')" --body "${body_message}" -l auto_merge
gh workflow run -R nesi/support-docs -r assets-update -f fileList=" " checks.yml
else
echo "no changes"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}