Per-pulse issue metrics (Multi Repo) #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Per-pulse issue metrics (Multi Repo) | |
on: | |
workflow_dispatch: | |
permissions: | |
issues: write | |
pull-requests: read | |
jobs: | |
build: | |
name: issue metrics | |
runs-on: ubuntu-latest | |
steps: | |
- name: Calculate query | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.CANONICAL_READ_TOKEN }} | |
run: | | |
pulse_start=$(date -d "1 fortnight ago" +%Y-%m-%d) | |
today=$(date +%Y-%m-%d) | |
team='canonical/soleng-reviewers' | |
teammembers=$(gh api /orgs/canonical/teams/solutions-engineering/members | jq -r '.[].login') | |
reviewedby='' | |
reviewrequested='' | |
teamreviewrequested='team-review-requested:canonical/soleng-reviewers' | |
for member in $teammembers; do | |
reviewedby="$reviewedby reviewed-by:$member" | |
reviewrequested="$reviewrequested review-requested:$member" | |
done | |
range="$pulse_start..$today" | |
query="type:pr org:canonical $reviewedby $reviewrequested $teamreviewrequested created:$range" | |
echo "$query" | |
echo "query=$query" >> "$GITHUB_ENV" | |
echo "range=$range" >> "$GITHUB_ENV" | |
- name: Get issue metrics | |
uses: github/issue-metrics@v2 | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SEARCH_QUERY: '${{ env.query }}' | |
HIDE_TIME_TO_ANSWER: 'true' | |
- name: Create issue | |
uses: peter-evans/create-issue-from-file@v5 | |
with: | |
title: 'Issue metrics report (${{ env.range }})' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
content-filepath: ./issue_metrics.md | |
assignees: aieri |