1
0
Fork 0
mirror of https://github.com/imjasonh/gcp-metrics-action synced 2026-07-15 20:58:06 +00:00
gcp-metrics-action/.github/workflows/use-action.yaml
Jason Hall a410dbb4ac support custom attributes, add fallback workflow_ref
Signed-off-by: Jason Hall <jason@chainguard.dev>
2025-11-11 23:03:43 -05:00

61 lines
1.7 KiB
YAML

name: Use Action
on:
push:
branches: [ main ]
pull_request_target:
branches: [ main ]
workflow_dispatch:
jobs:
example:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read # To view this workflow's metadata and logs
steps:
# ⚠️ When using credentials_json, you must check out the code first!!
- uses: actions/checkout@v5
with:
# For pull_request_target, checkout the PR head to test the PR's code
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: 'google-github-actions/auth@v3'
with:
credentials_json: '${{ secrets.SERVICE_ACCOUNT_KEY }}'
- uses: ./
with:
github-token: ${{ github.token }}
fail-on-error: 'true'
# Example: Add custom attributes to all metrics and traces
# attributes: |
# team: platform
# environment: production
# custom.label: ${{ matrix.os }}
- uses: actions/setup-node@v6
with:
node-version: '20'
- run: npm install
- run: npm run lint || echo "No lint script configured"
- run: npm test
- name: Create test artifact
run: |
mkdir -p build-output
echo "Build artifacts from run ${{ github.run_number }}" > build-output/results.txt
echo "Generated at $(date)" >> build-output/results.txt
ls -lh build-output/
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: test-build-output
path: build-output/
retention-days: 1
- run: echo "Building project..." && sleep 5 && echo "Build complete"