Current documentation stage #199
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: Check for Broken Links and Publish Wiki | |
'on': | |
push: | |
paths: | |
- '.github/workflows/broken-links-and-wiki.yaml' | |
- '**/*.md' | |
- 'wiki/**' | |
pull_request: | |
types: [ opened ] | |
branches: [ main ] | |
workflow_dispatch: | |
schedule: | |
# every monday at night | |
- cron: '0 1 * * 1' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "🛒 Checkout Repository (Release Perm.)" | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
lfs: true | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- name: "🌍 Load Versions to Use" | |
id: doc-global-versions | |
run: bash .github/workflows/scripts/global-configuration.sh | |
- name: "⬇️ Use Node.js" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.ACTION_NODE_VERSION }} | |
registry-url: "https://registry.npmjs.org/" | |
- name: "⬇️ Setup R" | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ env.ACTION_R_VERSION }} | |
- name: "📦 Install R Packages" | |
shell: Rscript {0} | |
run: install.packages("xmlparsedata", repos="https://cloud.r-project.org/") | |
- name: "🛒 Checkout LFS" | |
# just as a time-proven safety measure | |
run: git lfs checkout | |
- name: "🛠️ Update the Capabilities Wiki Page" | |
run: | | |
npm ci | |
# test if the file exists | |
if [ -f wiki/Capabilities.md ]; then | |
cp wiki/Capabilities.md wiki/Capabilities-Old.md | |
else | |
touch wiki/Capabilities-Old.md | |
fi | |
npm run capabilities-markdown --silent > wiki/Capabilities.md | |
# test if the file changed, but ignore the first line which contains the time stamp | |
if ! diff -q <(tail -n +2 wiki/Capabilities.md) <(tail -n +2 wiki/Capabilities-Old.md); then | |
echo "Capabilities changed!" | |
echo "CHANGED=true" >> $GITHUB_ENV | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add -f wiki/Capabilities.md | |
git commit -m "[skip ci] doc: update capabilities" | |
else | |
echo "Capabilities did not change!" | |
fi | |
# delete the old capabilities again | |
rm wiki/Capabilities-Old.md | |
- name: "⬆️ Push changed capabilities" | |
if: ${{ env.CHANGED == 'true' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && !failure() }} | |
uses: ad-m/github-push-action@master | |
with: | |
branch: main | |
github_token: ${{ secrets.RELEASE_TOKEN }} | |
force: true | |
- name: "⬆️ Publish the Wiki" | |
uses: Andrew-Chen-Wang/github-wiki-action@v4 | |
# We do not need to republish if nothing changes. Furthermore, do not publish on PR as this should be done by the push on main! | |
if: ${{ (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && !failure() }} | |
with: | |
path: "wiki/" | |
token: ${{ secrets.GH_DEPLOY_WIKI }} | |
- name: "🔎 Check the README for broken links" | |
uses: becheran/mlc@v0.18.0 | |
with: | |
args: --do-not-warn-for-redirect-to "http*://github.com/flowr-analysis/*,http*://flowr-analysis.github.io/*" --ignore-links "http*://hub.docker.com/r/*" README.md | |
- name: "🔎 Check the Wiki pages for broken links" | |
uses: becheran/mlc@v0.18.0 | |
if: ${{ always() && !failure() }} | |
with: | |
args: --do-not-warn-for-redirect-to "http*://github.com/flowr-analysis/*,http*://flowr-analysis.github.io/*" wiki/ |