Skip to content

Commit 5f23d3a

Browse files
authored
Merge pull request #168 from domaframework/ci/release-draft-timing
Add pull request trigger to release drafter workflow
2 parents 3b667eb + d04909d commit 5f23d3a

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

.github/workflows/release-drafter.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,18 @@ on:
44
push:
55
branches:
66
- main
7+
pull_request:
78
workflow_dispatch:
89

910
jobs:
1011
update_release_draft:
11-
if: ${{ !contains(github.head_ref, 'doc/changelog-update-') && startsWith(github.event.head_commit.message, 'Merge pull request') }}
1212
permissions:
1313
contents: write
1414
pull-requests: write
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 30
17-
outputs:
18-
skip_job: ${{ steps.check.outputs.SKIP_JOB }}
1917

2018
steps:
21-
- name: Check Commit Message
22-
id: check
23-
run: |
24-
# Define a regex pattern to match commit messages for changelog updates
25-
CHANGELOG_UPDATE_PATTERN="^Merge pull request #[0-9]+ from ${{ github.repository_owner }}/doc/changelog-update-.*$"
26-
27-
if [[ "${{ github.event.head_commit.message }}" =~ $CHANGELOG_UPDATE_PATTERN ]]; then
28-
echo "This commit is not target. Skip the workflow."
29-
echo "SKIP_JOB=true" >> $GITHUB_OUTPUT
30-
else
31-
echo "SKIP_JOB=false" >> $GITHUB_OUTPUT
32-
fi
3319
- uses: release-drafter/release-drafter@v6
3420
env:
3521
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -38,7 +24,7 @@ jobs:
3824

3925
update_version:
4026
needs: update_release_draft
41-
if: ${{ needs.update_release_draft.outputs.skip_job != 'true' }}
27+
if: ${{ !contains(github.head_ref, 'doc/changelog-update-') && startsWith(github.event.head_commit.message, 'Merge pull request') }}
4228
runs-on: ubuntu-latest
4329
timeout-minutes: 30
4430
permissions:
@@ -103,6 +89,7 @@ jobs:
10389
echo "No changes to commit."
10490
exit 0
10591
fi
106-
git commit -am "Update Version With Release Draft - $REPLACE_VERSION"
107-
git push origin main
92+
git commit -am "Update Version With Release Draft - $RELEASE_VERSION"
93+
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
94+
git push origin $BRANCH_NAME
10895

0 commit comments

Comments
 (0)