Skip to content

Commit e17e133

Browse files
committed
build: revert infinite loop changes
1 parent f3f57ec commit e17e133

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
name: Releases
2-
32
on:
4-
push:
3+
pull_request_target:
54
branches:
65
- main
6+
types:
7+
- closed
78

89
jobs:
910
merged-pr:
11+
if: github.event.pull_request.merged == true && !contains(github.event.pull_request.title, '[skip ci]')
1012
runs-on: ubuntu-latest
1113
permissions:
1214
id-token: write
1315
contents: read
14-
1516
steps:
17+
1618
- name: Generate GitHub app token
1719
id: generate_app_token
1820
uses: actions/create-github-app-token@v1
@@ -23,11 +25,12 @@ jobs:
2325
- name: Checkout code
2426
uses: actions/checkout@v4
2527
with:
28+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2629
token: ${{ steps.generate_app_token.outputs.token }}
27-
fetch-depth: 0
30+
fetch-depth: ${{ github.event.pull_request.commits }}
2831

2932
- name: Set up Node.js
30-
uses: actions/setup-node@v4
33+
uses: actions/setup-node@v3
3134
with:
3235
node-version: 24
3336
registry-url: "https://registry.npmjs.org"
@@ -40,14 +43,14 @@ jobs:
4043
run: |
4144
shopt -s nocasematch
4245
43-
COMMITS="$(git log --format=%B ${{ github.event.before }}..${{ github.sha }})"
46+
PR_TITLE='${{ github.event.pull_request.title }}'
4447
45-
if echo "$COMMITS" | grep -Eq '(\[breaking\]|\[major\])'; then
46-
echo "release_type=major" >> "$GITHUB_OUTPUT"
47-
elif echo "$COMMITS" | grep -Eq '\[minor\]'; then
48-
echo "release_type=minor" >> "$GITHUB_OUTPUT"
48+
if [[ "$PR_TITLE" =~ (\[breaking\]|\[major\]) ]]; then
49+
echo "release_type=major" >> $GITHUB_OUTPUT
50+
elif [[ "$PR_TITLE" =~ \[minor\] ]]; then
51+
echo "release_type=minor" >> $GITHUB_OUTPUT
4952
else
50-
echo "release_type=patch" >> "$GITHUB_OUTPUT"
53+
echo "release_type=patch" >> $GITHUB_OUTPUT
5154
fi
5255
5356
shopt -u nocasematch
@@ -78,12 +81,14 @@ jobs:
7881
id: standard-version
7982
run: |
8083
npx standard-version --release-as ${{ steps.determine-release.outputs.release_type }}
81-
echo "tag_name=$(git describe --abbrev=0 --tags)" >>"$GITHUB_OUTPUT"
84+
echo "tag_name=$(git describe --abbrev=0 --tags)" >>$GITHUB_OUTPUT
8285
8386
- name: Push tags and changelog
8487
run: git push --follow-tags origin main
88+
env:
89+
GH_TOKEN: ${{ steps.generate_app_token.outputs.token }}
8590

86-
- name: Create GitHub release
91+
- name: create release
8792
uses: actions/create-release@v1
8893
env:
8994
GITHUB_TOKEN: ${{ steps.generate_app_token.outputs.token }}
@@ -93,4 +98,4 @@ jobs:
9398
body: "${{ steps.changelog.outputs.clean_changelog }}"
9499

95100
- name: Publish package on NPM 📦
96-
run: npm publish --access public
101+
run: npm publish

0 commit comments

Comments
 (0)