From dbd52e2f34a7228222c6fee9ca079eab9d82af73 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 30 Oct 2022 16:39:33 -0700 Subject: [PATCH] Remove unused GitHub release download stats workflow The "github-stats" GitHub Actions workflow periodically gathers GitHub release asset download statistics for Arduino CLI and pushes the results to Datadog. There are no known problems with this workflow. However, the companion "arduino-stats" workflow that did the same for the downloads of Arduino IDE from downloads.arduino.cc was broken and thus removed from the repository. The GitHub stats are not very valuable on their own as they only provide an unknown fraction of the total downloads of Arduino IDE. They have also not ended up being used. The workflow also uses deprecated Node.js 12 runtime, which currently results in warnings printed to the workflow run summary page, but will eventually cause the complete breakage of the workflow. Since it doesn't provide any value and represents a maintenance burden, the workflow is hereby removed from the repository. --- .github/workflows/github-stats.yml | 96 ------------------------------ 1 file changed, 96 deletions(-) delete mode 100644 .github/workflows/github-stats.yml diff --git a/.github/workflows/github-stats.yml b/.github/workflows/github-stats.yml deleted file mode 100644 index c7c8a98a..00000000 --- a/.github/workflows/github-stats.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: github-stats - -on: - schedule: - # run every 30 minutes - - cron: "*/30 * * * *" - workflow_dispatch: - repository_dispatch: - -jobs: - push-stats: - # This workflow is only of value to the arduino/arduino-ide repository and - # would always fail in forks - if: github.repository == 'arduino/arduino-ide' - runs-on: ubuntu-latest - - steps: - - name: Fetch downloads count - id: fetch - uses: actions/github-script@v4 - with: - github-token: ${{github.token}} - script: | - let metrics = [] - - // Get a list of releases - const opts = github.repos.listReleases.endpoint.merge({ - ...context.repo - }) - const releases = await github.paginate(opts) - - // Get download stats for every release - for (const rel of releases) { - // Names for assets are like `arduino-ide_2.0.0-beta.12_Linux_64bit.zip`, - // we'll use this later to split the asset file name more easily - const baseName = `arduino-ide_${rel.name}_` - - // Get a list of assets for this release - const opts = github.repos.listReleaseAssets.endpoint.merge({ - ...context.repo, - release_id: rel.id - }) - const assets = await github.paginate(opts) - - for (const asset of assets) { - // Ignore files that are not arduino-ide packages - if (!asset.name.startsWith(baseName)) { - continue - } - - // Strip the base and remove file extension to get `Linux_32bit` - systemArch = asset.name.replace(baseName, "").split(".")[0].split("_") - - // Add a metric object to the list of gathered metrics - metrics.push({ - "type": "gauge", - "name": "arduino.downloads.total", - "value": asset.download_count, - "host": "${{ github.repository }}", - "tags": [ - `version:${rel.name}`, - `os:${systemArch[0]}`, - `arch:${systemArch[1]}`, - "cdn:github.com", - "project:arduino-ide" - ] - }) - } - } - - // The action will put whatever we return from this function in - // `outputs.result`, JSON encoded. So we just return the array - // of objects and GitHub will do the rest. - return metrics - - - name: Send metrics - uses: masci/datadog@v1 - with: - api-key: ${{ secrets.DD_API_KEY }} - # Metrics input expects YAML but JSON will work just right. - metrics: ${{steps.fetch.outputs.result}} - - - name: Report failure - if: failure() - uses: masci/datadog@v1 - with: - api-key: ${{ secrets.DD_API_KEY }} - events: | - - title: "Arduino IDE stats failing" - text: "Stats collection failed" - alert_type: "error" - host: ${{ github.repository }} - tags: - - "project:arduino-ide" - - "cdn:github.com" - - "workflow:${{ github.workflow }}"