start developing a prompt for gptel, aidermacs, etc. #20
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: Auto-Update README.md from README.org | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: # Allows manual triggering | |
permissions: | |
contents: write # 🔹 Allows the workflow to commit & push changes | |
jobs: | |
update-readmes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} # 🔹 Uses GitHub's built-in token for authentication | |
- name: Install Emacs | |
run: sudo apt-get install -y emacs | |
- name: Convert README.org to README.md using Emacs | |
run: | | |
find . -name "README.org" | while read orgfile; do | |
mdfile="${orgfile%.org}.md" | |
# Prepend required Org options before conversion | |
echo -e "#+OPTIONS: broken-links:mark ^:nil\n$(cat "$orgfile")" > "$orgfile.tmp" && mv "$orgfile.tmp" "$orgfile" | |
# Backup old README.md if it exists | |
[ -f "$mdfile" ] && cp "$mdfile" "$mdfile.old" | |
# Generate the new README.md | |
emacs --batch "$orgfile" --eval "(progn (require 'ox-md) (org-md-export-to-markdown))" | |
# Only stage if README.md has changed | |
if [ -f "$mdfile.old" ] && diff -q "$mdfile.old" "$mdfile" > /dev/null; then | |
echo "No changes in $mdfile" | |
rm "$mdfile.old" | |
else | |
echo "Updating $mdfile" | |
git add "$mdfile" | |
rm -f "$mdfile.old" | |
fi | |
done | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
# 🔹 Authenticate using GitHub token | |
git commit -m "Auto-update README.md from README.org" || exit 0 # Avoid error if no changes | |
git push |