Skip to content

Update README and Documentation Links #14

Update README and Documentation Links

Update README and Documentation Links #14

Workflow file for this run

name: Update README and Documentation Links
on:
workflow_run:
workflows:
- pages-build-deployment
types:
- completed
jobs:
update-links:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Pull latest changes
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git pull --rebase origin main
- name: Update README and documentation links
run: |
# Update links in README.md
README_FILE="index.html"
if [ -f "$README_FILE" ]; then
sed -i 's|\([^ )]*\)\.ipynb|\1.html|g' "$README_FILE"
sed -i 's|\([^ )]*\)\.md|\1.html|g' "$README_FILE"
fi
# Update links in markdown files in documentation folder
DOCS_DIR="documentation"
if [ -d "$DOCS_DIR" ]; then
find "$DOCS_DIR" -name '*.html' -type f | while read -r file; do
sed -i 's|\([^ )]*\)\.ipynb|\1.html|g' "$file"
sed -i 's|\([^ )]*\)\.md|\1.html|g' "$file"
done
fi
- name: Stage and commit changes
run: |
git add README.md documentation/*.md
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "Update links to HTML files in README and documentation"
git push
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}