Merge pull request #28 from PepperDash/feature-schedule #137
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: Gather Plugin URLs | |
| on: | |
| push: # Trigger the workflow on any push event | |
| branches: | |
| - main | |
| workflow_dispatch: # Allow manual triggering of the workflow | |
| inputs: | |
| mode: | |
| description: 'Mode (debug or production)' | |
| required: true | |
| default: 'production' | |
| schedule: # Trigger the workflow on a schedule | |
| - cron: '0 5 * * *' # Runs every day at 0500 UTC | |
| jobs: | |
| gather-plugin-urls: | |
| if: github.ref == 'refs/heads/main' || github.event_name != 'schedule' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Log branch and event type | |
| run: | | |
| echo "Branch: ${{ github.ref }}" | |
| echo "Event Name: ${{ github.event_name }}" | |
| if [ "${{ github.event_name }}" == "schedule" ]; then | |
| echo "This is a scheduled run." | |
| else | |
| echo "This is not a scheduled run." | |
| fi | |
| - uses: actions/checkout@v4 | |
| - name: Save previous README as README.old.md | |
| run: cp README.md README.old.md | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: pip install PyGithub | |
| - name: Gather repo URLs | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PEPPERDASH_ORG_READ }} | |
| ORG_NAME: 'PepperDash' | |
| MODE: ${{ github.event.inputs.mode }} | |
| run: python .github/scripts/gather_repo_urls.py | |
| - name: Upload Markdown file | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: all-repos-list | |
| path: README.md | |
| - name: Commit and push README.md | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add README.md | |
| git commit -m "Update README.md" || echo "No changes to commit" | |
| git push | |
| - name: Save new README as README.new.md | |
| run: cp README.md README.new.md | |
| - name: Generate unified diff | |
| run: diff -u README.old.md README.new.md > readme.diff || true | |
| - name: Install diff2html | |
| run: npm install -g diff2html-cli | |
| - name: Generate HTML visual diff | |
| run: | | |
| if [ -s readme.diff ]; then | |
| diff2html -i file -s side -F readme-diff.html -- readme.diff | |
| else | |
| echo "No changes detected, skipping diff2html." | |
| fi | |
| - name: Commit and push README diff HTML | |
| run: | | |
| git add readme-diff.html | |
| git commit -m "Add README diff HTML artifact [skip ci]" || echo "No changes to commit" | |
| git push |