Update Nibble Link #502
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: Update Nibble Link | |
on: | |
schedule: | |
- cron: '0 */3 * * 0,1,6' # Runs every 3 hours near publishing days | |
workflow_dispatch: | |
jobs: | |
update-link: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Update Nibble Link | |
run: node updateNibble.js | |
- name: Get latest Nibble number | |
id: read-nibble-link | |
run: echo "number=$(cat current_link.txt | cut -d'|' -f2)" >> $GITHUB_OUTPUT | |
- name: Push changes | |
run: | | |
git config user.name "Nibble Devs" | |
git config user.email "[email protected]" | |
if [[ -n "$(git status --porcelain)" ]]; then | |
git add . | |
git commit -m "Automated update of Nibble ${{ steps.read-nibble-link.outputs.number }}" | |
git push | |
else | |
echo "No changes to commit" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |