Get latest commit #338
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: Get latest commit | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
get-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- name: Fetch packwiz commit | |
run: | | |
curl -sL https://api.github.com/repos/packwiz/packwiz/commits | jq .[0].sha > current_commit.txt | |
- name: Check for new commit | |
id: git-check | |
run: | | |
echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") | |
- name: Update cached commit | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email 'github-actions@github.com' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git add current_commit.txt | |
git commit -m "chore: update packwiz commit" | |
git tag -a "$(date '+%Y%m%d')" -m "scheduled release" | |
git push --follow-tags |