forked from tabarra/txAdmin
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (54 loc) · 1.69 KB
/
locale-pull-request.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
name: Check Locale PR
on:
pull_request:
paths:
- 'locale/**'
jobs:
check-locale-pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Label PR and enforce base branch
uses: actions/[email protected]
with:
script: |
console.log(JSON.stringify(context.payload.pull_request));
const { repo, owner } = context.repo;
// Get the pull request
const pull_number = context.payload.pull_request.number;
const pull_request = await github.rest.pulls.get({
owner,
repo,
pull_number
});
// Add the 'translation' label
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['translation']
})
// Check if the base branch is 'main' or 'master'
if (pull_request.data.base.ref === 'main' || pull_request.data.base.ref === 'master') {
// Change the base branch to 'develop'
await github.rest.pulls.update({
owner,
repo,
pull_number,
base: 'develop'
});
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run locale:check
id: locale-check
run: npm run locale:check