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_update | |
on: | |
schedule: | |
- cron: '*/2 * * * *' | |
jobs: | |
check-updates: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Load Last Commit SHA | |
id: load-commit | |
run: | | |
last_commit=$(curl -s https://api.github.com/repos/RealEnder/dwpa/commits | jq -r '.[0].sha') | |
echo "last_commit=$last_commit" >> $GITHUB_ENV | |
- name: Download Last Commit Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: last-commit-sha | |
continue-on-error: true | |
- name: Compare Commits | |
id: compare | |
run: | | |
if [ "$last_commit" != "$(cat last_commit_sha.txt 2>/dev/null)" ]; then | |
echo "New version available!" | |
exit 1 # Workflow fehlschlagen, wenn eine neue Version verfügbar ist | |
else | |
echo "No new version." | |
fi | |
- name: Upload new commit SHA as artifact | |
if: success() | |
run: echo $last_commit > last_commit_sha.txt | |
uses: actions/upload-artifact@v3 | |
with: | |
name: last-commit-sha | |
path: last_commit_sha.txt |