Last active
November 1, 2024 02:51
-
-
Save alexeagle/ad3f1f4f90a5394a866bbb3a3b8d1de9 to your computer and use it in GitHub Desktop.
GitHub Actions to tag a repo at the beginning of each week. See blog.aspect.dev
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
# Apply a tag to HEAD at the beginning of each week. | |
# We can use this to create semver-looking tags for releases like | |
# 2020.44.123+abc1234 | |
on: | |
schedule: | |
# Mondays at 5am UTC / midnight EST | |
- cron: '0 5 * * 1' | |
jobs: | |
tagger: | |
runs-on: ubuntu-latest | |
steps: | |
- name: tag HEAD with date +%G.%V | |
run: | | |
curl --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/git/refs \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--data @- << EOF | |
{ | |
"ref": "refs/tags/$(date +%G.%V)", | |
"sha": "${{ github.sha }}" | |
} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FWIW, in a repo I'm using this GH Actions recipe on, I didn't see a bug this year when it produced tags. Maybe the LC_LOCALE is different from yours or something.