Skip to content

Automatically generate Code for API Updates and Release #2

Automatically generate Code for API Updates and Release

Automatically generate Code for API Updates and Release #2

Workflow file for this run

name: Check Tag on Automated Commit
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Get PR Author
id: pr_author
run: |
pr_author_email=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" \
| jq -r .user.email)
echo "author_email=$pr_author_email" >> $GITHUB_ENV
- name: Check for Single Tag on Last Commit
if: env.author_email == '[email protected]'
run: |
last_commit=$(git rev-parse HEAD)
tags=$(git tag --contains $last_commit)
tag_count=$(echo "$tags" | wc -l | xargs)
if [ "$tag_count" -ne 1 ]; then
echo "The last commit does not have exactly one tag."
exit 1
fi
echo "Commit $last_commit has exactly one tag: $tags"