Skip to content

Commit 9bef2c6

Browse files
committed
chore: auto-trigger create-github-release on release PR merge
Change workflow to automatically run when release PRs are merged. - Trigger on pull_request closed event instead of workflow_dispatch - Only run if PR was merged and title contains 'Release' - Support both main and version branches (e.g., 5.3-main) - Use PR base branch for checkout instead of manual input
1 parent e637e88 commit 9bef2c6

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

.github/workflows/create-github-release.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
name: Create GitHub Release
22

33
# This workflow creates a GitHub release in iOS-SDK and attaches the built zip files.
4-
# Run this AFTER the release PR has been merged.
4+
# Runs automatically when a release PR is merged.
55

66
on:
7-
workflow_dispatch:
8-
inputs:
9-
ref:
10-
description: 'Branch or commit SHA to run on (e.g., main, 5.3-main)'
11-
type: string
12-
required: false
13-
default: 'main'
7+
pull_request:
8+
types:
9+
- closed
10+
branches:
11+
- main
12+
- '*-main' # Matches version branches like 5.3-main
1413

1514
permissions:
1615
contents: write
@@ -23,14 +22,17 @@ concurrency:
2322
jobs:
2423
# Step 1: Extract version from podspec
2524
get-version:
25+
if: |
26+
github.event.pull_request.merged == true &&
27+
contains(github.event.pull_request.title, 'Release')
2628
runs-on: ubuntu-latest
2729
outputs:
2830
version: ${{ steps.extract_version.outputs.version }}
2931
steps:
3032
- name: Checkout OneSignal-iOS-SDK
3133
uses: actions/checkout@v4
3234
with:
33-
ref: ${{ github.event.inputs.ref }}
35+
ref: ${{ github.event.pull_request.base.ref }}
3436

3537
- name: Extract release version from podspec
3638
id: extract_version
@@ -59,7 +61,7 @@ jobs:
5961
- name: Checkout OneSignal-iOS-SDK
6062
uses: actions/checkout@v4
6163
with:
62-
ref: ${{ github.event.inputs.ref }}
64+
ref: ${{ github.event.pull_request.base.ref }}
6365

6466
- name: 📋 Display Configuration
6567
run: |

0 commit comments

Comments
 (0)