Skip to content

Commit c3a3209

Browse files
author
ace-n
committed
Add workflows config
1 parent b56b16d commit c3a3209

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/workflows/translate.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: translate
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'translate/**'
8+
pull_request:
9+
paths:
10+
- 'translate/**'
11+
pull_request_target:
12+
types: [labeled]
13+
schedule:
14+
- cron: '0 0 * * 0'
15+
jobs:
16+
test:
17+
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 60
20+
permissions:
21+
contents: 'write'
22+
pull-requests: 'write'
23+
id-token: 'write'
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
ref: ${{github.event.pull_request.head.ref}}
28+
repository: ${{github.event.pull_request.head.repo.full_name}}
29+
- uses: google-github-actions/[email protected]
30+
with:
31+
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
32+
service_account: '[email protected]'
33+
create_credentials_file: 'true'
34+
access_token_lifetime: 600s
35+
- uses: actions/setup-node@v3
36+
with:
37+
node-version: 14
38+
- run: npm install
39+
working-directory: translate
40+
- run: npm test
41+
working-directory: translate
42+
env:
43+
MOCHA_REPORTER_SUITENAME: translate
44+
MOCHA_REPORTER_OUTPUT: translate_sponge_log.xml
45+
MOCHA_REPORTER: xunit
46+
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
47+
uses: actions/github-script@v6
48+
with:
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
script: |
51+
try {
52+
await github.rest.issues.removeLabel({
53+
name: 'actions:force-run',
54+
owner: 'GoogleCloudPlatform',
55+
repo: 'nodejs-docs-samples',
56+
issue_number: context.payload.pull_request.number
57+
});
58+
} catch (e) {
59+
if (!e.message.includes('Label does not exist')) {
60+
throw e;
61+
}
62+
}
63+
- if: ${{ github.event_name == 'schedule' && always() }}
64+
run: |
65+
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
66+
chmod +x ./flakybot
67+
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

.github/workflows/workflows.json

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"scheduler",
6060
"service-directory/snippets",
6161
"talent",
62+
"translate",
6263
"video-intelligence",
6364
"contact-center-insights",
6465
"workflows"

0 commit comments

Comments
 (0)