|
| 1 | +name: cloud-language |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + paths: |
| 7 | + - 'cloud-language/**' |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - 'cloud-language/**' |
| 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 | + |
| 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 | + |
| 36 | + with: |
| 37 | + node-version: 16 |
| 38 | + - run: npm install |
| 39 | + working-directory: cloud-language |
| 40 | + - run: npm test |
| 41 | + working-directory: cloud-language |
| 42 | + env: |
| 43 | + MOCHA_REPORTER_SUITENAME: cloud_language |
| 44 | + MOCHA_REPORTER_OUTPUT: cloud_language_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