Check and Update Releases #4
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: Check and Update Releases | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # Runs daily at midnight UTC | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| check-releases: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Ensure all branches are fetched | |
| - name: Switch to gh-pages branch | |
| run: git checkout gh-pages | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install dependencies | |
| run: npm install axios | |
| - name: Check and update latest releases | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: node check-releases.js | |
| - name: Commit changes | |
| run: | | |
| git config --local user.name "GitHub Actions Bot" | |
| git config --local user.email "[email protected]" | |
| # Commit badges.json changes | |
| git add badges.json | |
| git commit -m "Update badges.json with latest release URLs" || echo "No changes to commit for badges.json" | |
| git push origin gh-pages | |
| - name: Switch to main branch | |
| run: git checkout main | |
| - name: Commit README.md changes | |
| run: | | |
| git add README.md | |
| git commit -m "Update README.md with updated GitHub download links" || echo "No changes to commit for README.md" | |
| git push origin main | |
| - name: Create pull request | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| base: main | |
| branch: update-releases | |
| title: "Update badges.json and README.md" | |
| body: | | |
| This pull request updates: | |
| - `badges.json` with the latest release URLs. | |
| - `README.md` with updated GitHub download links. | |
| labels: "automated update" | |
| assignees: "Garlicrot" |