Skip to content

🤖 Daily tag

🤖 Daily tag #138

name: "🤖 Daily tag"
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
new-tag:
name: New tag
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_TOKEN }}
- name: "Create a new daily tag"
run: |
tag=d"$(date -u +'%Y%m%d')"
echo "Name of a new tag is $tag"
tag_commit=$(git rev-list -n 1 $(git describe --tags --abbrev=0))
echo "$tag -> $tag_commit"
master_commit=$(git rev-list -n 1 master)
echo "master -> $master_commit"
# Create a new tag only if the latest tag does not
# point to the same commit as the master branch.
if [ "$tag_commit" != "$master_commit" ]; then
git config user.email github-actions@github.com
git config user.name "${{ github.actor }}"
git tag $tag
git push origin $tag
fi