Skip to content

Commit b71143b

Browse files
author
Ahrar Monsur
committed
Adds workflows config for nodejs-asset
1 parent 1369793 commit b71143b

File tree

3 files changed

+71
-2
lines changed

3 files changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
"appengine/hello-world/flexible",
88
"appengine/hello-world/standard",
99
"appengine/memcached",
10-
"apengine/metadata/flexible",
10+
"appengine/metadata/flexible",
1111
"appengine/metadata/standard",
1212
"appengine/pubsub",
1313
"appengine/static-files",
1414
"appengine/storage/flexible",
1515
"appengine/storage/standard",
16+
"asset/snippets",
1617
"auth",
1718
"appengine/typescript",
1819
"appengine/websockets",

asset/snippets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@google-cloud/asset-samples",
33
"description": "Samples for the Cloud Asset API Client Library for Node.js.",
44
"license": "Apache-2.0",
5-
"author": "Google Inc.",
5+
"author": "Google LLC",
66
"engines": {
77
"node": ">=12.0.0"
88
},

0 commit comments

Comments
 (0)