Skip to content

Commit

Permalink
Adds workflows config for nodejs-asset
Browse files Browse the repository at this point in the history
  • Loading branch information
ahrarmonsur authored and Ace Nassri committed Nov 17, 2022
1 parent dec876b commit 2b46d8c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/asset-snippets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: asset-snippets
on:
push:
branches:
- main
paths:
- 'asset/snippets/**'
pull_request:
paths:
- 'asset/snippets/**'
pull_request_target:
types: [labeled]
paths:
- 'asset/snippets/**'
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3.1.0
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: 'google-github-actions/auth@v1.0.0'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3.5.1
with:
node-version: 16
- run: npm install
working-directory: asset/snippets
- run: npm test
working-directory: asset/snippets
env:
MOCHA_REPORTER_SUITENAME: asset_snippets
MOCHA_REPORTER_OUTPUT: asset_snippets_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
3 changes: 2 additions & 1 deletion .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
"appengine/hello-world/flexible",
"appengine/hello-world/standard",
"appengine/memcached",
"apengine/metadata/flexible",
"appengine/metadata/flexible",
"appengine/metadata/standard",
"appengine/pubsub",
"appengine/static-files",
"appengine/storage/flexible",
"appengine/storage/standard",
"asset/snippets",
"auth",
"automl",
"appengine/typescript",
Expand Down
2 changes: 1 addition & 1 deletion asset/snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@google-cloud/asset-samples",
"description": "Samples for the Cloud Asset API Client Library for Node.js.",
"license": "Apache-2.0",
"author": "Google Inc.",
"author": "Google LLC",
"engines": {
"node": ">=12.0.0"
},
Expand Down

0 comments on commit 2b46d8c

Please sign in to comment.