-
-
Notifications
You must be signed in to change notification settings - Fork 83
67 lines (56 loc) · 1.95 KB
/
i18n-summary.yml
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
name: i18n Summary
on:
push:
branches:
- main
paths:
- .phrasey/**
- i18n/**
pull_request_target:
types:
- opened
- edited
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
PR_COMMENT: "no"
jobs:
i18n-summary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.13.0"
cache: npm
- name: 🏗️ Prerequisites
run: npm install
- name: 🔨 Build
run: npm run i18n:summary
- name: 🚀 Push summary files
if: github.event_name != 'pull_request_target'
uses: zyrouge/gh-push-action@v1
with:
directory: phrasey-dist
branch: i18n-summary
checkout-orphan: true
force: true
- name: 🔎 Check pull request changes
if: github.event_name == 'pull_request_target' && github.event.pull_request.draft == false
run: |
git fetch origin "${{ github.base_ref }}" --depth=1
echo "PR_COMMENT=$(npm run --silent git:diff-files-yn 'origin/${{ github.base_ref }}' '.phrasey/' 'i18n/')" >> $GITHUB_ENV
- name: 💬 Comment summary
if: env.PR_COMMENT == 'yes'
uses: actions/github-script@v7
with:
script: |
const content = require("fs").readFileSync("phrasey-dist/README.md", "utf-8");
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: content,
});