release: v2024.2.0-kakurega.1.29.3 #29
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: PR latest version check | |
on: | |
pull_request: | |
types: [synchronize] | |
jobs: | |
check-latest-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: get package version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: check version | |
id: check-version | |
run: | | |
echo "Check if the version name has changed" | |
echo "Using repository: ${{ github.repository }}" | |
gh repo set-default ${{ github.repository }} | |
TITLE=$(gh pr view ${{ github.event.number }} --json title --jq '.title') | |
IS_RELEASE_PR=$(echo $TITLE | grep 'release:' | wc -l) | |
COUNT=$(echo $TITLE | grep '${{ steps.package-version.outputs.current-version }}' | wc -l) | |
if [ $((IS_RELEASE_PR)) -eq 0 ]; then | |
echo "exists=true" >> $GITHUB_OUTPUT | |
echo "This PR is not a release PR" | |
exit 0 | |
fi | |
if [ $((COUNT)) -gt 0 ]; then | |
echo "exists=true" >> $GITHUB_OUTPUT | |
echo "Version already exists" | |
else | |
echo "exists=false" >> $GITHUB_OUTPUT | |
echo "Version does not exist" | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: update pr | |
if: steps.check-version.outputs.exists == 'false' | |
shell: bash | |
run: | | |
gh pr edit ${{ github.event.number }} -t "release: v${{ steps.package-version.outputs.current-version }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |