This commit is contained in:
Aasim Khan 2024-08-10 17:56:16 -07:00
Родитель 98f912acb3
Коммит 4149c21987
1 изменённых файлов: 0 добавлений и 48 удалений

48
.github/workflows/pull-request.yml поставляемый
Просмотреть файл

@ -1,48 +0,0 @@
name: Version Update Check in Pull Request
on:
pull_request:
branches:
- main
permissions:
contents: read
jobs:
check_version_update:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check package version
id: check_version
run: |
VERSION=$(jq -r '.version' package.json)
echo "version=${VERSION}" >> $GITHUB_ENV
if git rev-parse "${VERSION}" >/dev/null 2>&1; then
echo "Tag v${VERSION} already exists."
echo "updated=true" >> $GITHUB_ENV
else
echo "Tag v${VERSION} does not exist."
echo "updated=false" >> $GITHUB_ENV
IFS='.' read -r -a version_parts <<< "$VERSION"
((versionParts[2]++))
newVersion="${versionParts[0]}.${versionParts[1]}.${versionParts[2]}"
echo "newVersion=${newVersion}" >> $GITHUB_ENV
fi
- name: Comment on Pull Request
if : env.updated == 'false'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'The package version has not been updated. Please update it to ${{ env.newVersion }} to publish a new release 🚀.'
})