Skip to content

Commit c7d9d8c

Browse files
committed
cleanup: use the composed environment setup
1 parent b0dcb4f commit c7d9d8c

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Setup Environment'
2+
description: 'Common setup steps for Unity release workflows (Git config and environment prep)'
3+
4+
inputs:
5+
gh_token:
6+
description: 'GitHub token for gh CLI authentication'
7+
required: true
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Configure Git
13+
shell: bash
14+
run: |
15+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
16+
git config --global user.name "github-actions[bot]"
17+
18+
- name: Prepare Environment
19+
env:
20+
GH_TOKEN: ${{ inputs.gh_token }}
21+
shell: bash
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install -y gh jq || true
25+
gh auth status || gh auth login --with-token <<< "$GH_TOKEN"
26+

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

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,11 @@ jobs:
5757
uses: actions/checkout@v5
5858
with:
5959
ref: ${{ needs.prep.outputs.release_branch }}
60-
61-
- name: Configure Git
62-
run: |
63-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
64-
git config --global user.name "github-actions[bot]"
65-
66-
- name: Prepare Environment
67-
env:
68-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
run: |
70-
sudo apt-get update
71-
sudo apt-get install -y gh jq || true
72-
gh auth status || gh auth login --with-token <<< "$GH_TOKEN"
60+
61+
- name: Setup Environment
62+
uses: ./.github/actions/setup-environment
63+
with:
64+
gh_token: ${{ secrets.GITHUB_TOKEN }}
7365

7466
- name: Get current native SDK versions
7567
id: current_versions
@@ -156,6 +148,11 @@ jobs:
156148
with:
157149
ref: ${{ needs.prep.outputs.release_branch }}
158150

151+
- name: Setup Environment
152+
uses: ./.github/actions/setup-environment
153+
with:
154+
gh_token: ${{ secrets.GITHUB_TOKEN }}
155+
159156
- name: Update Unity SDK version
160157
run: |
161158
echo "Updating Unity SDK version to ${{ inputs.unity_version }}"
@@ -164,7 +161,7 @@ jobs:
164161
PADDED_VERSION=$(printf "%06d" $(echo "${{ inputs.unity_version }}" | sed 's/[^0-9]//g'))
165162
166163
# VERSION file
167-
echo "${{ inputs.unity_version }}" > OneSignalExample/Assets/OneSignal/VERSION
164+
printf "%s" "${{ inputs.unity_version }}" > OneSignalExample/Assets/OneSignal/VERSION
168165
169166
# package.json files
170167
for file in com.onesignal.unity.core/package.json com.onesignal.unity.android/package.json com.onesignal.unity.ios/package.json; do
@@ -201,7 +198,7 @@ jobs:
201198
- name: Cache Unity
202199
uses: actions/cache@v4
203200
with:
204-
path: /home/runner/Unity/Hub/Editor
201+
path: /home/runner/Unity/Hub
205202
key: UnityEditor-${{ runner.os }}
206203
restore-keys: |
207204
UnityEditor-${{ runner.os }}

0 commit comments

Comments
 (0)