austenstone / copilot-usage

Create copilot usage reports as job summaries, and much more!
MIT License
12 stars 4 forks source link

[Bug] Action runs but fails with an error? #155

Open msarm-1debit opened 3 weeks ago

msarm-1debit commented 3 weeks ago

What happened?

The workflow ran successfully but came with this error.

Relevant log output

Run austenstone/copilot-usage@v4.2
Fetching Copilot usage for organization <redacted>
Fetched Copilot usage data for 28 days (2024-10-03 to 2024-10-30)
Fetching Copilot details for organization <redacted>
Fetching Copilot seat assignments for organization <redacted>
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 16517
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is 33664e617e68c54f41b9a862e62d4e2e48314f4b17a5ec20d81f897e712db461
Finalizing artifact upload
Artifact copilot-usage.zip successfully finalized. Artifact ID 2126591388
Artifact name is valid!
Root directory input is valid!

/home/runner/work/_actions/austenstone/copilot-usage/v4.2/node_modules/@actions/artifact/lib/internal/shared/artifact-twirp-client.js:54
                throw new Error(`Failed to ${method}: ${error.message}`);
^
Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
    at ArtifactHttpClient.<anonymous> (/home/runner/work/_actions/austenstone/copilot-usage/v4.2/node_modules/@actions/artifact/lib/internal/shared/artifact-twirp-client.js:54:1)
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/austenstone/copilot-usage/v4.2/node_modules/@actions/artifact/lib/internal/shared/artifact-twirp-client.js:6:1)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Contact Details

No response

austenstone commented 3 weeks ago

Can you provide your workflow yml? I believe you're trying to create 2 artifacts with the same name.

msarm-1debit commented 3 weeks ago
# https://github.com/marketplace/actions/copilot-usage-action

name: Copilot Usage Metrics Collector
on:
  schedule:
    - cron: '0 5 * * 1'
  workflow_dispatch:
  push:

jobs:
  run:
    name: Run Action
    runs-on: ubuntu-latest
    steps:
      - uses: austenstone/copilot-usage@v4.2
        with:
          github-token: ${{ secrets.COPILOT_USAGE_METRICS }}
          organization: '<org>'
          csv: true
          time-zone: 'EST'
oppermax commented 1 week ago

Experiencing the same error with this configuration:

name: Copilot Usage Report
on:
  schedule:
    - cron: '0 0 * * *' # the job will run at midnight every day.
  workflow_dispatch:

jobs:
  run:
    name: Run Action
    runs-on: ubuntu-latest
    steps:
      - uses: austenstone/copilot-usage@v4.1
        with:
          github-token: ${{ secrets.TOKEN }}
          time-zone: 'CET' # IANA time zone identifier https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
          csv: true # Optional flag to output a CSV report

In fact, this configuration also doesn't create a csv file but a json. Downgrading to v4.0 seems to work as intended.