Skip to content

Commit

Permalink
issue-pr-contrib-metrics: detailed discussions, improved explanations.
Browse files Browse the repository at this point in the history
Signed-off-by: Thilo Fromm <[email protected]>
  • Loading branch information
t-lo committed Nov 9, 2023
1 parent e62d3fd commit d50dfe9
Showing 1 changed file with 116 additions and 46 deletions.
162 changes: 116 additions & 46 deletions .github/workflows/issue-pr-contrib-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ jobs:
echo "START_DATE=$start_date" >> "$GITHUB_ENV"
echo "END_DATE=$end_date" >> "$GITHUB_ENV"
#
# Contributors stats
#
- name: Collect contributor metrics
uses: github/contributors@v1
env:
Expand All @@ -52,66 +55,64 @@ 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: New PRs opened (and still open) metrics
#
# Discussions stats
#
- name: All open discussions summary 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 created:${{ env.START_DATE }}..${{ env.END_DATE }}'
# "time to answer" only supported for discussions
HIDE_TIME_TO_ANSWER: true
SEARCH_QUERY: 'repo:flatcar/Flatcar type:discussions is:open,unanswered'
# This metric measures items that are still open
HIDE_TIME_TO_CLOSE: true
IGNORE_USERS: "flatcar-infra,github-actions[bot],dependabot[bot]"

- name: rename new PRs metrics file
- name: rename open discussion metrics file
shell: bash
run: |
set -euo pipefail
mv issue_metrics.md prs_opened.md
mv issue_metrics.md discussion_open.md
- name: PRs closed metrics
- name: New discussions 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 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],dependabot[bot]"

- name: rename closed PRs metrics file
SEARCH_QUERY: 'repo:flatcar/Flatcar type:discussions is:open,unanswered created:${{ env.START_DATE }}..${{ env.END_DATE }}'
# This metric measures items that are still open
HIDE_TIME_TO_CLOSE: true
- name: rename open discussion metrics file
shell: bash
run: |
set -euo pipefail
mv issue_metrics.md prs_closed.md
mv issue_metrics.md discussion_opened.md
- name: Total open PRs metrics
- name: Discussions Answered or Closed 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],dependabot[bot]"

- name: rename open PR metrics file
SEARCH_QUERY: 'repo:flatcar/Flatcar type:discussions is:answered,closed created:${{ env.START_DATE }}..${{ env.END_DATE }}'
- name: rename open discussion metrics file
shell: bash
run: |
set -euo pipefail
mv issue_metrics.md prs_open.md
- name: Collect discussion metrics
mv issue_metrics.md discussion_closed.md
#
# Issues stats
#
- name: All open Issues summary metrics
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }}
SEARCH_QUERY: 'repo:flatcar/Flatcar type:discussions created:${{ env.START_DATE }}..${{ env.END_DATE }}'

- name: rename discussion metrics file
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],dependabot[bot]"
- name: rename open issues metrics file
shell: bash
run: |
set -euo pipefail
mv issue_metrics.md discussion_metrics.md
mv issue_metrics.md issues_open.md
- name: New issues opened (and still open) metrics
uses: github/issue-metrics@v2
Expand All @@ -123,7 +124,6 @@ jobs:
# This metric measures items that are still open
HIDE_TIME_TO_CLOSE: true
IGNORE_USERS: "flatcar-infra,github-actions[bot],dependabot[bot]"

- name: rename new issues opened metrics file
shell: bash
run: |
Expand All @@ -138,30 +138,65 @@ jobs:
# "time to answer" only supported for discussions
HIDE_TIME_TO_ANSWER: true
IGNORE_USERS: "flatcar-infra,github-actions[bot],dependabot[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
#
# Pull Requests stats
#
- name: All open PRs summary metrics
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GH_ACTION_METRICS_ORG_READ }}
SEARCH_QUERY: 'org:flatcar is:issue is:open'
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],dependabot[bot]"
- name: rename open PR metrics file
shell: bash
run: |
set -euo pipefail
mv issue_metrics.md prs_open.md
- 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 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],dependabot[bot]"
- name: rename new PRs metrics file
shell: bash
run: |
set -euo pipefail
mv issue_metrics.md prs_opened.md
- name: rename issues closed metrics file
- 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],dependabot[bot]"
- name: rename closed PRs metrics file
shell: bash
run: |
set -euo pipefail
mv issue_metrics.md issues_open.md
mv issue_metrics.md prs_closed.md
#
# Upload and post-process, create issue
#

- name: Upload individual reports
uses: actions/upload-artifact@v3
with:
Expand All @@ -178,31 +213,66 @@ jobs:
cat contributors.md > report.md
echo -e "\n\n# Discussions Metrics" >> report.md
tail --lines=+2 discussion_metrics.md >> report.md
echo -e "\n## Summary of all open Discussions" >> report.md
echo "These summary statistics include all currently open discussions (openend at any point in the past)." \
>> report.md
# remove full discussions list from stats; we only want the summary
tail --lines=+2 discussion_open.md \
| awk '/^\| Title \| URL \| Author \|/{silent=1} {if (silent==0) print $0}' \
>> report.md
echo -e "\n## New discussions" >> report.md
echo -e "\nThese discussions were created between ${{ env.START_DATE }} - ${{ env.END_DATE }} and are still open." \
>> report.md
tail --lines=+2 discussion_opened.md >> report.md
echo -e "\n## Discussions closed" >> report.md
echo -e "\nThese discussions were openend and also closed between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
>> report.md
echo -e "(Discussions search is somewhat limited on Github; there's currently no way to search for discussions answered within a given timespan)" \
>> report.md
tail --lines=+2 discussion_closed.md >> report.md
echo -e "\n\n# Issue Metrics" >> report.md
echo -e "\n## Open Issues Summary" >> report.md
echo -e "\n## Summary of all open Issues" >> report.md
echo "These summary statistics include all currently open issues (openend at any point in the past)." \
>> 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}' \
>> report.md
echo -e "\n## New Issues created (and still open)" >> report.md
echo -e "\n## New Issues" >> report.md
echo -e "\nThese issues were created between ${{ env.START_DATE }} - ${{ env.END_DATE }} and are still open." \
>> report.md
tail --lines=+2 issues_opened.md >> report.md
echo -e "\n## Issues closed" >> report.md
echo -e "\nThese issues were openend at any point in the past and were closed between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
>> report.md
tail --lines=+2 issues_closed.md >> report.md
echo -e "\n\n# Pull Requests Metrics" >> report.md
echo -e "\n## Open PRs Summary" >> report.md
echo -e "\n## Summary of all open PRs" >> report.md
echo "These summary statistics include all currently open PRs (openend at any point in the past)." \
>> 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}' \
>> report.md
echo -e "\n## New PRs created (and still open)" >> report.md
echo -e "\n## New PRs" >> report.md
echo -e "\nThese PRs were created between ${{ env.START_DATE }} - ${{ env.END_DATE }} and are still open." \
>> report.md
tail --lines=+2 prs_opened.md >> report.md
echo -e "\n## PRs closed" >> report.md
echo -e "\nThese PRs were openend at any point in the past and were closed between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
>> report.md
tail --lines=+2 prs_closed.md >> report.md
- name: Create issue
Expand Down

0 comments on commit d50dfe9

Please sign in to comment.