Github Action with a cronjob trigger #65
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: Github Action with a cronjob trigger | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
jobs: | |
sync-files: | |
name: "Run sync" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout source repository" | |
uses: actions/checkout@v4 | |
- name: "List releases" | |
run: | | |
curl -Ls https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" > latest-release.txt | |
- name: "Push to Source" | |
run: | | |
git config --global user.name "ivan-hc" | |
git config --global user.email "[email protected]" | |
git add latest-release.txt | |
if git diff-index --quiet HEAD; then | |
echo "No changes to commit." >> $GITHUB_STEP_SUMMARY | |
else | |
git commit -m "Sync files from source repository" | |
git push && echo "Sync to Source succeeded" >> $GITHUB_STEP_SUMMARY | |
fi |