int128 / datadog-actions-metrics

Send GitHub Actions metrics to Datadog for developer experience
Apache License 2.0
65 stars 22 forks source link

No job metrics sent #516

Open craig-cazoo opened 1 year ago

craig-cazoo commented 1 year ago

Hi, I recently started using this action and was able to start sending workflow metrics easily

However, I have ran into an issue when enabling collect-job-metrics

No job metrics are being sent to datadog and I get the following warning for my workflow:

Warning: Could not get the check suite: GraphqlError: Resource not accessible by integration

Here's my workflow:

name: Track deployment workflow metrics to Datadog

on:
    workflow_run:
        workflows:
            - Deploy to dev environment
            - Deploy to test environment
            - Deploy to prod environment
        types:
            - completed

jobs:
    send_metrics:
        runs-on: ubuntu-latest
        timeout-minutes: 10
        steps:
            - uses: int128/datadog-actions-metrics@v1
              with:
                  datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
                  datadog-site: datadoghq.eu
                  collect-job-metrics: true
                  github-token: ${{ secrets.GITHUB_TOKEN }}

Do I need to enable some permissions for my github token or have I set up my workflow incorrectly?

Many thanks

Craig

int128 commented 1 year ago

This action requires checks scope for the job and step metrics.

If you are using the default token (i.e., GITHUB_TOKEN), see https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token. If you are using your personal token or GitHub App, you may need to explicitly give the permission.

craig-cazoo commented 1 year ago

Thanks for the response @int128. But I tried adding read and write permissions for checks but I'm still seeing the same warning and no job metrics are being sent.

Are there any other permissions that I should be adding? I am using the default token but I believe my organisation has restricted access by default.

uittorio commented 1 year ago

FYI, Another issue was open about this and after some manual trial and error I've found the necessary permissions. https://github.com/int128/datadog-actions-metrics/issues/614