InkHUD Todo List #346
This file contains hidden or 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: InkHUD Todo List | |
| on: | |
| schedule: | |
| - cron: "0 12 * * *" # Runs daily at 12:00 UTC | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| update_todo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| - name: Fetch latest todo.txt | |
| run: | | |
| curl -o todo.txt https://raw.githubusercontent.com/todd-herbert/meshtastic-firmware/InkHUD/todo.txt | |
| - name: Ensure Directories Exist | |
| run: | | |
| mkdir -p InkHUD | |
| - name: Extract Previous Completed Section | |
| run: | | |
| if [ -f "InkHUD/Todo-List.md" ]; then | |
| awk '/## Completed/{flag=1; next} flag' InkHUD/Todo-List.md > completed.txt | |
| else | |
| touch completed.txt | |
| fi | |
| - name: Create Updated Todo List | |
| run: | | |
| echo "---" > InkHUD/Todo-List.md | |
| echo "layout: default" >> InkHUD/Todo-List.md | |
| echo "title: Todo List" >> InkHUD/Todo-List.md | |
| echo "---" >> InkHUD/Todo-List.md | |
| echo "# Todo List" >> InkHUD/Todo-List.md | |
| echo "" >> InkHUD/Todo-List.md | |
| echo "**Last updated: $(date -u)**" >> InkHUD/Todo-List.md | |
| echo "" >> InkHUD/Todo-List.md | |
| echo "## Features" >> InkHUD/Todo-List.md | |
| awk '/Features/{flag=1;next}/^$/{flag=0}flag' todo.txt | sed -E 's/\[\]/- [ ]/g; s/\[wip\]/- 🛠 **(WIP)**/g' >> InkHUD/Todo-List.md | |
| echo "" >> InkHUD/Todo-List.md | |
| echo "## Critical Tasks" >> InkHUD/Todo-List.md | |
| awk '/Critical Tasks/{flag=1;next}/^$/{flag=0}flag' todo.txt | sed -E 's/\[\]/- [ ]/g; s/\[wip\]/- 🛠 **(WIP)**/g' >> InkHUD/Todo-List.md | |
| echo "" >> InkHUD/Todo-List.md | |
| echo "## Improvements" >> InkHUD/Todo-List.md | |
| awk '/Improvements/{flag=1;next}/^$/{flag=0}flag' todo.txt | sed -E 's/\[\]/- [ ]/g; s/\[wip\]/- 🛠 **(WIP)**/g' >> InkHUD/Todo-List.md | |
| echo "" >> InkHUD/Todo-List.md | |
| echo "## Known Bugs" >> InkHUD/Todo-List.md | |
| awk '/Known Bugs/{flag=1;next}/^$/{flag=0}flag' todo.txt | sed -E 's/\[\]/- [ ]/g; s/\[wip\]/- 🛠 **(WIP)**/g' >> InkHUD/Todo-List.md | |
| echo "" >> InkHUD/Todo-List.md | |
| echo "## Chores" >> InkHUD/Todo-List.md | |
| awk '/Chores/{flag=1;next}/^$/{flag=0}flag' todo.txt | sed -E 's/\[\]/- [ ]/g; s/\[wip\]/- 🛠 **(WIP)**/g' >> InkHUD/Todo-List.md | |
| echo "" >> InkHUD/Todo-List.md | |
| - name: Identify Removed Tasks & Append to Completed | |
| run: | | |
| # Extract current tasks from the latest Todo List | |
| grep -E "^- \[ \]" InkHUD/Todo-List.md | sort > current.txt || touch current.txt | |
| # Extract previous tasks from the stored previous version | |
| if [ -f "InkHUD/Todo-List-Previous.txt" ]; then | |
| grep -E "^- \[ \]" InkHUD/Todo-List-Previous.txt | sort > previous.txt || touch previous.txt | |
| else | |
| touch previous.txt | |
| fi | |
| # Identify removed tasks (completed tasks) | |
| comm -23 previous.txt current.txt > removed.txt || touch removed.txt | |
| # Append removed tasks to the "Completed" section if any exist | |
| if [ -s removed.txt ]; then | |
| echo "" >> InkHUD/Todo-List.md | |
| echo "## Completed" >> InkHUD/Todo-List.md | |
| cat removed.txt >> InkHUD/Todo-List.md | |
| elif [ -s completed.txt ]; then | |
| echo "" >> InkHUD/Todo-List.md | |
| echo "## Completed" >> InkHUD/Todo-List.md | |
| cat completed.txt >> InkHUD/Todo-List.md | |
| fi | |
| # Store the new version as the reference for the next update | |
| cp InkHUD/Todo-List.md InkHUD/Todo-List-Previous.txt | |
| - name: Commit and Push Changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add InkHUD/Todo-List.md InkHUD/Todo-List-Previous.txt | |
| git commit -m "Automated update of Todo List with completed tasks" || echo "No changes to commit" | |
| git push origin main |