Skip to content

Commit 0e2fbf4

Browse files
Roger MartinezAce Nassri
Roger Martinez
authored and
Ace Nassri
committed
add workflows to github workflows config
1 parent 7fa7ab2 commit 0e2fbf4

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

.github/workflows/workflows.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@
5050
"datacatalog/quickstart",
5151
"datastore/functions",
5252
"talent",
53-
"contact-center-insights"
53+
"contact-center-insights",
54+
"workflows"
5455
]

.github/workflows/workflows.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: workflows
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'workflows/**'
8+
pull_request:
9+
paths:
10+
- 'workflows/**'
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/[email protected]
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/[email protected]
36+
with:
37+
node-version: 16
38+
- run: npm install
39+
working-directory: workflows
40+
- run: npm test
41+
working-directory: workflows
42+
env:
43+
MOCHA_REPORTER_SUITENAME: workflows
44+
MOCHA_REPORTER_OUTPUT: workflows_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'}}
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}}

0 commit comments

Comments
 (0)