-
Notifications
You must be signed in to change notification settings - Fork 56
69 lines (59 loc) · 1.81 KB
/
translations-export.yml
File metadata and controls
69 lines (59 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# Workflow to ensure translation export files are up to date on PRs
name: Translations Export
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
translations-export:
name: Export Translations
runs-on: windows-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: 2740120
private-key: ${{ secrets.POWER_PAGES_PUBLIC_GITHUB_APP_PRIVATE_KEY }}
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
token: ${{ steps.app-token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Run Translations Export
run: npm run translations-export
- name: Check for Changes
id: check-changes
run: |
git add -A
git diff --cached --quiet
if ($LASTEXITCODE -eq 0) {
echo "has_changes=false" >> $env:GITHUB_OUTPUT
} else {
echo "has_changes=true" >> $env:GITHUB_OUTPUT
}
exit 0
- name: Commit and Push Changes
if: steps.check-changes.outputs.has_changes == 'true'
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Automated translations export from CI"
git push