diff --git a/.github/workflows/issue-pr-contrib-metrics.yaml b/.github/workflows/issue-pr-contrib-metrics.yaml index 355f222..a001ab1 100644 --- a/.github/workflows/issue-pr-contrib-metrics.yaml +++ b/.github/workflows/issue-pr-contrib-metrics.yaml @@ -52,22 +52,56 @@ jobs: REPOSITORY: "flatcar/nebraska,flatcar/flatcar-website,flatcar/flatcar-build-scripts,flatcar/baselayout,flatcar/bootengine,flatcar/coreos-cloudinit,flatcar/flatcar-dev-util,flatcar/init,flatcar/locksmith,flatcar/mantle,flatcar/mayday,flatcar/nss-altfiles,flatcar/scripts,flatcar/seismograph,flatcar/shim,flatcar/sysroot-wrappers,flatcar/toolbox,flatcar/torcx,flatcar/update-ssh-keys,flatcar/update_engine,flatcar/updateservicectl,flatcar/Flatcar,flatcar/flatcar-packer-qemu,flatcar/flatcar-ipxe-scripts,flatcar/flatcar-cloud-image-uploader,flatcar/flatcar-linux-update-operator,flatcar/flatcar-release-mirror,flatcar/flatcar-terraform,flatcar/sdnotify-proxy,flatcar/flatcar-automation,flatcar/nebraska-update-agent,flatcar/fleetlock,flatcar/flog,flatcar/ign-converter,flatcar/nomad-on-flatcar,flatcar/sysext-bakery,flatcar/reports,flatcar/flatcar-demos,flatcar/jitsi-server,flatcar/flatcar-mastodon,flatcar/ue-rs,flatcar/azure-marketplace-ingestion-api" SPONSOR_INFO: "false" - - name: Collect PR metrics + - name: New PRs opened (and still open) metrics uses: github/issue-metrics@v2 env: GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }} - SEARCH_QUERY: 'org:flatcar is:pr -author:flatcar-infra created:${{ env.START_DATE }}..${{ env.END_DATE }}' + SEARCH_QUERY: 'org:flatcar is:pr is:open -author:flatcar-infra created:${{ env.START_DATE }}..${{ env.END_DATE }}' + # "time to answer" only supported for discussions + HIDE_TIME_TO_ANSWER: true + # This metric measures items that are still open + HIDE_TIME_TO_CLOSE: true + IGNORE_USERS: "flatcar-infra,github-actions[bot]" + + - name: rename new PRs metrics file + shell: bash + run: | + set -euo pipefail + mv issue_metrics.md prs_opened.md + + - name: PRs closed metrics + uses: github/issue-metrics@v2 + env: + GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }} + SEARCH_QUERY: 'org:flatcar is:pr -author:flatcar-infra closed:${{ env.START_DATE }}..${{ env.END_DATE }}' # "time to answer" only supported for discussions HIDE_TIME_TO_ANSWER: true IGNORE_USERS: "flatcar-infra,github-actions[bot]" - - name: rename PR metrics file + - name: rename closed PRs metrics file shell: bash run: | set -euo pipefail - mv issue_metrics.md pr_metrics.md + mv issue_metrics.md prs_closed.md + + - name: Total open PRs metrics + uses: github/issue-metrics@v2 + env: + GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }} + SEARCH_QUERY: 'org:flatcar is:pr is:open -author:flatcar-infra' + # "time to answer" only supported for discussions + HIDE_TIME_TO_ANSWER: true + # This metric measures items that are still open + HIDE_TIME_TO_CLOSE: true + IGNORE_USERS: "flatcar-infra,github-actions[bot]" + + - name: rename open PR metrics file + shell: bash + run: | + set -euo pipefail + mv issue_metrics.md prs_open.md - - name: Collect discussion metrics + - name: Collect discussion metrics uses: github/issue-metrics@v2 env: GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }} @@ -78,27 +112,91 @@ jobs: run: | set -euo pipefail mv issue_metrics.md discussion_metrics.md - - - name: Collect issue metrics + + - name: New issues opened (and still open) metrics uses: github/issue-metrics@v2 env: GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }} - SEARCH_QUERY: 'org:flatcar is:issue created:${{ env.START_DATE }}..${{ env.END_DATE }}' + SEARCH_QUERY: 'org:flatcar is:issue is:open created:${{ env.START_DATE }}..${{ env.END_DATE }}' + # "time to answer" only supported for discussions + HIDE_TIME_TO_ANSWER: true + # This metric measures items that are still open + HIDE_TIME_TO_CLOSE: true + IGNORE_USERS: "flatcar-infra,github-actions[bot]" + + - name: rename new issues opened metrics file + shell: bash + run: | + set -euo pipefail + mv issue_metrics.md issues_opened.md + + - name: Issues closed metrics + uses: github/issue-metrics@v2 + env: + GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }} + SEARCH_QUERY: 'org:flatcar is:issue closed:${{ env.START_DATE }}..${{ env.END_DATE }}' # "time to answer" only supported for discussions HIDE_TIME_TO_ANSWER: true IGNORE_USERS: "flatcar-infra,github-actions[bot]" + + - name: rename issues closed metrics file + shell: bash + run: | + set -euo pipefail + mv issue_metrics.md issues_closed.md + - name: Total open Issues metrics + uses: github/issue-metrics@v2 + env: + GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }} + SEARCH_QUERY: 'org:flatcar is:issue is:open' + # "time to answer" only supported for discussions + HIDE_TIME_TO_ANSWER: true + # This metric measures items that are still open + HIDE_TIME_TO_CLOSE: true + IGNORE_USERS: "flatcar-infra,github-actions[bot]" + + - name: rename issues closed metrics file + shell: bash + run: | + set -euo pipefail + mv issue_metrics.md issues_open.md + + - name: Upload individual reports + uses: actions/upload-artifact@v3 + with: + retention-days: 32 + name: raw-reports + path: | + ./*.md + - name: Assemble full report shell: bash run: | set -euo pipefail + cat contributors.md > report.md + echo -e "\n\n# Discussions Metrics" >> report.md tail --lines=+2 discussion_metrics.md >> report.md - # issues already have the correct headline - cat issue_metrics.md >> report.md + + echo -e "\n\n# Issue Metrics" >> report.md + # remove full issues list from stats; we only want the summary + tail --lines=+2 issues_open.md | awk '/^\| Title \| URL \| Author \|/{silent=1} {if (silent==0) print $0}' + + echo -e "\n## New Issues" >> report.md + tail --lines=+2 issues_opened.md >> report.md + echo -e "\n## Closed Issues" >> report.md + tail --lines=+2 issues_closed.md >> report.md + echo -e "\n\n# Pull Requests Metrics" >> report.md - tail --lines=+2 pr_metrics.md >> report.md + # remove full PRs list from stats; we only want the summary + tail --lines=+2 prs_open.md | awk '/^\| Title \| URL \| Author \|/{silent=1} {if (silent==0) print $0}' + + echo -e "\n## New PRs" >> report.md + tail --lines=+2 prs_opened.md >> report.md + echo -e "\n## Closed PRs" >> report.md + tail --lines=+2 prss_closed.md >> report.md - name: Create issue uses: peter-evans/create-issue-from-file@v4