Check Moodle Version and Tag #1
Workflow file for this run
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: Check Moodle Version and Tag | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Run this task daily | |
jobs: | |
check-version-and-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check Moodle Latest Version | |
id: check_moodle | |
run: | | |
LATEST_MOODLE_VERSION=$(curl -s https://api.github.com/repos/moodle/moodle/tags | jq -r '.[0].name') | |
echo "LATEST_MOODLE_VERSION=$LATEST_MOODLE_VERSION" >> $GITHUB_ENV | |
- name: Create Tag if New | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
CURRENT_VERSION=$(git tag --sort=-v:refname | head -n 1) | |
if [ "$CURRENT_VERSION" != "$LATEST_MOODLE_VERSION" ]; then | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git tag $LATEST_MOODLE_VERSION | |
git push origin $LATEST_MOODLE_VERSION | |
else | |
echo "Latest version is already tagged." | |