Skip to content

Commit cd465d6

Browse files
committed
rename the secret to GH_PUSH_TOKEN
1 parent cf252ae commit cd465d6

File tree

4 files changed

+108
-58
lines changed

4 files changed

+108
-58
lines changed

.github/workflows/cd.yml

Lines changed: 49 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,51 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: '[Setup] Checkout Repository'
16-
uses: actions/checkout@v3
17-
with:
18-
persist-credentials: false
19-
token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
16+
uses: actions/checkout@v6
17+
2018
- name: '[Setup] Node'
21-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@v6
2220
with:
2321
node-version: 18
22+
2423
- name: '[Setup] Bootstrap Dependencies'
25-
run: bash scripts/bootstrap-dependencies
24+
run: npm ci
25+
2626
- name: '[Setup] Git'
2727
run: |
2828
git config --global user.email "noreply@onesignal.com"
2929
git config --global user.name "OneSignal"
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
30+
3231
- name: 'Get current web-shim-codegen version'
3332
run: |
3433
echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
34+
3535
- name: '[Setup] Build'
3636
run: npm run build
37+
3738
- name: '[onesignal-ngx] Checkout'
38-
uses: actions/checkout@v3
39+
uses: actions/checkout@v6
3940
with:
40-
token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
41+
token: ${{ secrets.GH_PUSH_TOKEN }}
4142
repository: OneSignal/onesignal-ngx
4243
fetch-depth: 0
4344
path: __clone/onesignal-ngx
45+
4446
- name: '[onesignal-ngx] Patch'
4547
run: |
46-
bash scripts/clean-repo.sh __clone/onesignal-ngx package-lock.json
47-
tar zxvvf dist/onesignal-ngx.tgz -C __clone/
48-
cd __clone/onesignal-ngx
49-
git add -A
50-
if git commit -m "feat: sync with web-shim-codegen v${{ env.PACKAGE_VERSION }}"; then
51-
echo "onesignal-ngx repository has been updated"
52-
else
53-
echo "onesignal-ngx repository has NOT been updated, no changes to commit"
54-
fi
48+
bash scripts/patch-repo.sh dist/onesignal-ngx.tgz __clone/onesignal-ngx onesignal-ngx
49+
env:
50+
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
51+
5552
- name: '[onesignal-ngx] Push'
5653
uses: ad-m/github-push-action@v0.6.0
5754
with:
5855
repository: OneSignal/onesignal-ngx
5956
directory: __clone/onesignal-ngx
6057
force: true
6158
branch: cd_update
62-
github_token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
59+
github_token: ${{ secrets.GH_PUSH_TOKEN }}
60+
6361
- name: '[onesignal-ngx] Submit PR'
6462
uses: octokit/request-action@v2.x
6563
continue-on-error: true
@@ -72,34 +70,32 @@ jobs:
7270
title: 'sync with web-shim-codegen v${{ env.PACKAGE_VERSION }}'
7371
body: 'This update was generated by the GitHub CD action.'
7472
env:
75-
GITHUB_TOKEN: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
73+
GITHUB_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
74+
7675
- name: '[react-onesignal] Checkout'
7776
uses: actions/checkout@v3
7877
with:
79-
token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
78+
token: ${{ secrets.GH_PUSH_TOKEN }}
8079
repository: OneSignal/react-onesignal
8180
fetch-depth: 0
8281
submodules: true
8382
path: __clone/react
83+
8484
- name: '[react-onesignal] Patch'
8585
run: |
86-
bash scripts/clean-repo.sh __clone/react
87-
tar zxvvf dist/react.tgz -C __clone/
88-
cd __clone/react
89-
git add -A
90-
if git commit -m "feat: sync with web-shim-codegen v${{ env.PACKAGE_VERSION }}"; then
91-
echo "react-onesignal repository has been updated"
92-
else
93-
echo "react-onesignal repository has NOT been updated, no changes to commit"
94-
fi
86+
bash scripts/patch-repo.sh dist/react.tgz __clone/react react-onesignal
87+
env:
88+
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
89+
9590
- name: '[react-onesignal] Push'
9691
uses: ad-m/github-push-action@v0.6.0
9792
with:
9893
repository: OneSignal/react-onesignal
9994
directory: __clone/react
10095
force: true
10196
branch: cd_update
102-
github_token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
97+
github_token: ${{ secrets.GH_PUSH_TOKEN }}
98+
10399
- name: '[react-onesignal] Submit PR'
104100
uses: octokit/request-action@v2.x
105101
continue-on-error: true
@@ -112,33 +108,31 @@ jobs:
112108
title: 'sync with web-shim-codegen v${{ env.PACKAGE_VERSION }}'
113109
body: 'This update was generated by the GitHub CD action.'
114110
env:
115-
GITHUB_TOKEN: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
111+
GITHUB_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
112+
116113
- name: '[onesignal-vue] Checkout'
117114
uses: actions/checkout@v3
118115
with:
119-
token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
116+
token: ${{ secrets.GH_PUSH_TOKEN }}
120117
repository: OneSignal/onesignal-vue
121118
fetch-depth: 0
122119
path: __clone/vue/v2
120+
123121
- name: '[onesignal-vue] Patch'
124122
run: |
125-
bash scripts/clean-repo.sh __clone/vue/v2
126-
tar zxvvf dist/vue/v2.tgz -C __clone/
127-
cd __clone/vue/v2
128-
git add -A
129-
if git commit -m "feat: sync with web-shim-codegen v${{ env.PACKAGE_VERSION }}"; then
130-
echo "onesignal-vue repository has been updated"
131-
else
132-
echo "onesignal-vue repository has NOT been updated, no changes to commit"
133-
fi
123+
bash scripts/patch-repo.sh dist/vue/v2.tgz __clone/vue/v2 onesignal-vue
124+
env:
125+
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
126+
134127
- name: '[onesignal-vue] Push'
135128
uses: ad-m/github-push-action@v0.6.0
136129
with:
137130
repository: OneSignal/onesignal-vue
138131
directory: __clone/vue/v2
139132
force: true
140133
branch: cd_update
141-
github_token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
134+
github_token: ${{ secrets.GH_PUSH_TOKEN }}
135+
142136
- name: '[onesignal-vue] Submit PR'
143137
uses: octokit/request-action@v2.x
144138
continue-on-error: true
@@ -151,33 +145,31 @@ jobs:
151145
title: 'sync with web-shim-codegen v${{ env.PACKAGE_VERSION }}'
152146
body: 'This update was generated by the GitHub CD action.'
153147
env:
154-
GITHUB_TOKEN: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
148+
GITHUB_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
149+
155150
- name: '[onesignal-vue3] Checkout'
156151
uses: actions/checkout@v3
157152
with:
158-
token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
153+
token: ${{ secrets.GH_PUSH_TOKEN }}
159154
repository: OneSignal/onesignal-vue3
160155
fetch-depth: 0
161156
path: __clone/vue/v3
157+
162158
- name: '[onesignal-vue3] Patch'
163159
run: |
164-
bash scripts/clean-repo.sh __clone/vue/v3
165-
tar zxvvf dist/vue/v3.tgz -C __clone/
166-
cd __clone/vue/v3
167-
git add -A
168-
if git commit -m "feat: sync with web-shim-codegen v${{ env.PACKAGE_VERSION }}"; then
169-
echo "onesignal-vue3 repository has been updated"
170-
else
171-
echo "onesignal-vue3 repository has NOT been updated, no changes to commit"
172-
fi
160+
bash scripts/patch-repo.sh dist/vue/v3.tgz __clone/vue/v3 onesignal-vue3
161+
env:
162+
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
163+
173164
- name: '[onesignal-vue3] Push'
174165
uses: ad-m/github-push-action@v0.6.0
175166
with:
176167
repository: OneSignal/onesignal-vue3
177168
directory: __clone/vue/v3
178169
force: true
179170
branch: cd_update
180-
github_token: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
171+
github_token: ${{ secrets.GH_PUSH_TOKEN }}
172+
181173
- name: '[onesignal-vue3] Submit PR'
182174
uses: octokit/request-action@v2.x
183175
continue-on-error: true
@@ -190,4 +182,4 @@ jobs:
190182
title: 'sync with web-shim-codegen v${{ env.PACKAGE_VERSION }}'
191183
body: 'This update was generated by the GitHub CD action.'
192184
env:
193-
GITHUB_TOKEN: ${{ secrets.GH_WEB_SHIM_PUSH_TOKEN }}
185+
GITHUB_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-shim-codegen",
3-
"version": "3.0.6",
3+
"version": "3.0.7",
44
"description": "Used to build Web SDK libraries for various web frameworks",
55
"main": "index.js",
66
"scripts": {

scripts/patch-repo.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Usage: patch-repo.sh <tar-file> <target-directory> <repo-name>
5+
# Example: patch-repo.sh dist/react.tgz __clone/react react-onesignal
6+
# Requires PACKAGE_VERSION environment variable to be set
7+
8+
if [ $# -lt 3 ]; then
9+
echo "Usage: $0 <tar-file> <target-directory> <repo-name>"
10+
exit 1
11+
fi
12+
13+
TAR_FILE="$1"
14+
TARGET_DIR="$2"
15+
REPO_NAME="$3"
16+
VERSION="${PACKAGE_VERSION:-unknown}"
17+
18+
if [ ! -f "$TAR_FILE" ]; then
19+
echo "Error: Tar file $TAR_FILE does not exist"
20+
exit 1
21+
fi
22+
23+
if [ ! -d "$TARGET_DIR" ]; then
24+
echo "Error: Target directory $TARGET_DIR does not exist"
25+
exit 1
26+
fi
27+
28+
# Remove .github directory to ensure clean extraction
29+
cd "$TARGET_DIR"
30+
rm -rf .github
31+
cd - > /dev/null
32+
33+
# Extract tar archive
34+
tar zxvvf "$TAR_FILE" -C "$(dirname "$TARGET_DIR")"
35+
36+
# Add all changes and commit
37+
cd "$TARGET_DIR"
38+
git add -A
39+
if git commit -m "feat: sync with web-shim-codegen v$VERSION"; then
40+
echo "$REPO_NAME repository has been updated"
41+
else
42+
echo "$REPO_NAME repository has NOT been updated, no changes to commit"
43+
fi
44+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Checks if the PR title follows semantic commit message conventions
2+
name: Lint PR
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
types: [opened, edited, synchronize]
10+
11+
jobs:
12+
call:
13+
uses: OneSignal/sdk-actions/.github/workflows/lint-pr-title.yml@main
14+
secrets: inherit

0 commit comments

Comments
 (0)