@@ -22,47 +22,47 @@ jobs:
2222 branch : ${{ steps.fetch-pr.outputs.branch }}
2323
2424 steps :
25- - name : Generate Github Token for CI Bot
26- uses : actions/create-github-app-token@v1
27- id : generate-token
28- with :
29- app-id : ${{ secrets.CI_APP_ID }}
30- private-key : ${{ secrets.CI_APP_PRIVATE_KEY }}
31-
32- - name : Check out repository
33- uses : actions/checkout@v4
34- with :
35- token : ${{ steps.generate-token.outputs.token }}
36-
37- - name : Fetch PR details
38- id : fetch-pr
39- run : |
40- PR_DETAILS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "${{ github.event.issue.pull_request.url }}")
41- PR_BRANCH=$(echo "$PR_DETAILS" | jq -r '.head.ref')
42-
43- skip () {
44- echo "$1 Exiting..."
45- echo "skip=true" >> $GITHUB_OUTPUT
46- echo "skipReason=$1" >> $GITHUB_OUTPUT
47- }
48-
49- if [[ $PR_BRANCH == "i18n/"* ]]; then
50- skip "Branch \`$PR_BRANCH\` is a i18n branch."
51- fi
52-
53- PR_BRANCH=$(echo "$PR_DETAILS" | jq -r '.head.label' | sed 's/:/\//g')
54- NEW_BRANCH="i18n/$PR_BRANCH"
55- echo "newBranch=$NEW_BRANCH" >> $GITHUB_OUTPUT
56- echo "branch=$PR_BRANCH" >> $GITHUB_OUTPUT
57-
58- git config --global user.name "livecodes-ci[bot]"
59- git config --global user.email "186997172+livecodes-ci[bot]@users.noreply.github.com"
60-
61- if [[ ! $(git ls-remote --heads origin $NEW_BRANCH) ]]; then
62- skip "Branch \`$NEW_BRANCH\` does not exist."
63- fi
64- env :
65- GITHUB_TOKEN : ${{ steps.generate-token.outputs.token }}
25+ - name : Generate Github Token for CI Bot
26+ uses : actions/create-github-app-token@v1
27+ id : generate-token
28+ with :
29+ app-id : ${{ secrets.CI_APP_ID }}
30+ private-key : ${{ secrets.CI_APP_PRIVATE_KEY }}
31+
32+ - name : Check out repository
33+ uses : actions/checkout@v4
34+ with :
35+ token : ${{ steps.generate-token.outputs.token }}
36+
37+ - name : Fetch PR details
38+ id : fetch-pr
39+ run : |
40+ PR_DETAILS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "${{ github.event.issue.pull_request.url }}")
41+ PR_BRANCH=$(echo "$PR_DETAILS" | jq -r '.head.ref')
42+
43+ skip () {
44+ echo "$1 Exiting..."
45+ echo "skip=true" >> $GITHUB_OUTPUT
46+ echo "skipReason=$1" >> $GITHUB_OUTPUT
47+ }
48+
49+ if [[ $PR_BRANCH == "i18n/"* ]]; then
50+ skip "Branch \`$PR_BRANCH\` is a i18n branch."
51+ fi
52+
53+ PR_BRANCH=$(echo "$PR_DETAILS" | jq -r '.head.label' | sed 's/:/\//g')
54+ NEW_BRANCH="i18n/$PR_BRANCH"
55+ echo "newBranch=$NEW_BRANCH" >> $GITHUB_OUTPUT
56+ echo "branch=$PR_BRANCH" >> $GITHUB_OUTPUT
57+
58+ git config --global user.name "livecodes-ci[bot]"
59+ git config --global user.email "186997172+livecodes-ci[bot]@users.noreply.github.com"
60+
61+ if [[ ! $(git ls-remote --heads origin $NEW_BRANCH) ]]; then
62+ skip "Branch \`$NEW_BRANCH\` does not exist."
63+ fi
64+ env :
65+ GITHUB_TOKEN : ${{ steps.generate-token.outputs.token }}
6666
6767 runner :
6868 name : Runner
@@ -74,61 +74,61 @@ jobs:
7474 PR_BRANCH : ${{ needs.precheck.outputs.branch }}
7575
7676 steps :
77- - name : Generate Github Token for CI Bot
78- uses : actions/create-github-app-token@v1
79- id : generate-token
80- with :
81- app-id : ${{ secrets.CI_APP_ID }}
82- private-key : ${{ secrets.CI_APP_PRIVATE_KEY }}
83-
84- - name : Check out repository
85- uses : actions/checkout@v4
86- with :
87- ref : ${{ needs.precheck.outputs.newBranch }}
88- token : ${{ steps.generate-token.outputs.token }}
89-
90- - name : Setup Node
91- uses : actions/setup-node@v4
92- with :
93- node-version : ${{ env.NODE_VERSION }}
94- cache : ' npm'
95- cache-dependency-path : ' **/package-lock.json'
96-
97- - name : Install dependencies
98- run : npm ci
99-
100- - name : Import from Lokalise
101- run : |
102- mkdir -p $LOKALISE_TEMP && touch $LOKALISE_TEMP/locales.zip && npm run i18n-update-pull -- $PR_BRANCH && rm -rf $LOKALISE_TEMP
103- env :
104- LOKALISE_TEMP : lokalise_tmp
105-
106- - name : Generate Lokalise JSON files
107- run : npm run i18n-lokalise-json all
108-
109- - name : Linting and fixing
110- run : npm run fix
111-
112- - name : Commit changes
113- run : |
114- git config --global user.name "livecodes-ci[bot]"
115- git config --global user.email "186997172+livecodes-ci[bot]@users.noreply.github.com"
116- git add .
117-
118- # Only commit if there are changes
119- git diff-index --quiet HEAD || git commit -m "i18n: pull translation from Lokalise"
120-
121- # Save SHA of the latest commit to locale
122- echo "LAST_COMMIT_SHA=$(git log -n 1 --format="%H" -- src/livecodes/i18n/locales)" >> $GITHUB_ENV
123-
124- - name : Push changes
125- run : git push origin $NEW_BRANCH
126-
127- - name : Create a new i18n PR, comment on source PR and reaction
128- uses : actions/github-script@v7
129- with :
130- github-token : ${{ steps.generate-token.outputs.token }}
131- script : |
77+ - name : Generate Github Token for CI Bot
78+ uses : actions/create-github-app-token@v1
79+ id : generate-token
80+ with :
81+ app-id : ${{ secrets.CI_APP_ID }}
82+ private-key : ${{ secrets.CI_APP_PRIVATE_KEY }}
83+
84+ - name : Check out repository
85+ uses : actions/checkout@v4
86+ with :
87+ ref : ${{ needs.precheck.outputs.newBranch }}
88+ token : ${{ steps.generate-token.outputs.token }}
89+
90+ - name : Setup Node
91+ uses : actions/setup-node@v4
92+ with :
93+ node-version : ${{ env.NODE_VERSION }}
94+ cache : ' npm'
95+ cache-dependency-path : ' **/package-lock.json'
96+
97+ - name : Install dependencies
98+ run : npm ci
99+
100+ - name : Import from Lokalise
101+ run : |
102+ mkdir -p $LOKALISE_TEMP && touch $LOKALISE_TEMP/locales.zip && npm run i18n-update-pull -- $PR_BRANCH && rm -rf $LOKALISE_TEMP
103+ env :
104+ LOKALISE_TEMP : lokalise_tmp
105+
106+ - name : Generate Lokalise JSON files
107+ run : npm run i18n-lokalise-json all
108+
109+ - name : Linting and fixing
110+ run : npm run fix
111+
112+ - name : Commit changes
113+ run : |
114+ git config --global user.name "livecodes-ci[bot]"
115+ git config --global user.email "186997172+livecodes-ci[bot]@users.noreply.github.com"
116+ git add .
117+
118+ # Only commit if there are changes
119+ git diff-index --quiet HEAD || git commit -m "i18n: pull translation from Lokalise"
120+
121+ # Save SHA of the latest commit to locale
122+ echo "LAST_COMMIT_SHA=$(git log -n 1 --format="%H" -- src/livecodes/i18n/locales)" >> $GITHUB_ENV
123+
124+ - name : Push changes
125+ run : git push origin $NEW_BRANCH
126+
127+ - name : Create a new i18n PR, comment on source PR and reaction
128+ uses : actions/github-script@v7
129+ with :
130+ github-token : ${{ steps.generate-token.outputs.token }}
131+ script : |
132132 const repoURL = context.payload.repository.html_url;
133133 const branchURL = `${repoURL}/tree/${process.env.NEW_BRANCH}`;
134134 const prTitle = `i18n: ${{ github.event.issue.title }}`;
@@ -146,7 +146,7 @@ jobs:
146146 - [ ] 📦 Chore (Release)
147147 - [ ] ⏩ Revert
148148 - [x] 🌐 Internationalization / Translation
149-
149+
150150 ## Description
151151 ### i18n Actions: \`.i18n-update-pull\`
152152 Localization pulled from Lokalise.
@@ -155,7 +155,7 @@ jobs:
155155 | --- | --- |
156156 | **i18n Branch** | [\`${process.env.NEW_BRANCH}\`](${branchURL}) |
157157 | **Last Commit SHA** | ${process.env.LAST_COMMIT_SHA} |
158-
158+
159159 ## Related Tickets & Documents
160160 - **Source PR**: #${{ github.event.issue.number }}
161161 `;
@@ -178,7 +178,7 @@ jobs:
178178 | **Last Commit SHA** | ${process.env.LAST_COMMIT_SHA} |
179179 | **i18n PR** | #${prInfo.data.number} |
180180 `;
181-
181+
182182 github.rest.issues.createComment({
183183 issue_number: context.issue.number,
184184 owner: context.repo.owner,
@@ -192,7 +192,7 @@ jobs:
192192 comment_id: ${{ github.event.comment.id }},
193193 content: 'rocket'
194194 });
195-
195+
196196 exception :
197197 name : Exception
198198 runs-on : ubuntu-latest
@@ -202,22 +202,22 @@ jobs:
202202 SKIP_REASON : ${{ needs.precheck.outputs.skipReason }}
203203
204204 steps :
205- - name : Generate Github Token for CI Bot
206- uses : actions/create-github-app-token@v1
207- id : generate-token
208- with :
209- app-id : ${{ secrets.CI_APP_ID }}
210- private-key : ${{ secrets.CI_APP_PRIVATE_KEY }}
211-
212- - name : Create reaction on PR
213- uses : actions/github-script@v7
214- with :
215- github-token : ${{ steps.generate-token.outputs.token }}
216- script : |
205+ - name : Generate Github Token for CI Bot
206+ uses : actions/create-github-app-token@v1
207+ id : generate-token
208+ with :
209+ app-id : ${{ secrets.CI_APP_ID }}
210+ private-key : ${{ secrets.CI_APP_PRIVATE_KEY }}
211+
212+ - name : Create reaction on PR
213+ uses : actions/github-script@v7
214+ with :
215+ github-token : ${{ steps.generate-token.outputs.token }}
216+ script : |
217217 const runURL = `${context.payload.repository.html_url}/actions/runs/${process.env.GITHUB_RUN_ID}`;
218218 const commentBody = `## i18n Actions: \`.i18n-update-pull\`
219219 Failed to perform action due to following reason: **${process.env.SKIP_REASON}**
220-
220+
221221 Please check [action logs](${runURL}) for more details.
222222 `;
223223 github.rest.issues.createComment({
0 commit comments