Skip to content

Create GH workflow to generate github metrics #6

Create GH workflow to generate github metrics

Create GH workflow to generate github metrics #6

Workflow file for this run

name: Monthly metrics
# on:
# workflow_dispatch:
# schedule:
# - cron: '3 2 1 * *'
on: [pull_request]
runs-on: ubuntu-latest

Check failure on line 8 in .github/workflows/github-metrics.yml

View workflow run for this annotation

GitHub Actions / Monthly metrics

Invalid workflow file

The workflow is not valid. .github/workflows/github-metrics.yml (Line: 8, Col: 1): Unexpected value 'runs-on' .github/workflows/github-metrics.yml (Line: 12, Col: 5): Required property is missing: runs-on
jobs:
get_dates:
name: Get Dates
steps:
- name: Get dates for last month
shell: bash
run: |
# Get the current date
current_date=$(date +'%Y-%m-%d')
# Calculate the previous month
previous_date=$(date -d "$current_date -1 month" +'%Y-%m-%d')
# Put the report month and year in the environment
echo report_month="$(date -d "$previous_date" +'%B') $(date -d "$previous_date" +'%Y')" >> "$GITHUB_ENV"
# Extract the year and month from the previous date
previous_year=$(date -d "$previous_date" +'%Y')
previous_month=$(date -d "$previous_date" +'%m')
# Calculate the first day of the previous month
first_day=$(date -d "$previous_year-$previous_month-01" +'%Y-%m-%d')
# Calculate the last day of the previous month
last_day=$(date -d "$first_day +1 month -1 day" +'%Y-%m-%d')
echo "$first_day..$last_day"
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
# Issues
issues_opened:
name: Issues Opened
needs: get_dates
steps:
- name: Run issue-metrics tool for issues opened last month
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
SEARCH_QUERY: 'org:appwrite org:open-runtimes org:utopia-php is:issue created:${{ env.last_month }}'
HIDE_TIME_TO_ANSWER: true
- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: Issues Opened in ${{ env.report_month }}
content-filepath: ./issue_metrics.md
issues_closed:
name: Issues Closed
needs: get_dates
steps:
- name: Run issue-metrics tool for issues closed last month
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
SEARCH_QUERY: 'org:appwrite org:open-runtimes org:utopia-php is:issue closed:${{ env.last_month }}'
HIDE_TIME_TO_ANSWER: true
- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: Issues Closed in ${{ env.report_month }}
content-filepath: ./issue_metrics.md
# PRs
prs_opened:
name: PRs Opened
needs: get_dates
steps:
- name: Run issue-metrics tool for PRs opened last month
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
SEARCH_QUERY: 'org:appwrite org:open-runtimes org:utopia-php is:pull-request created:${{ env.last_month }}'
HIDE_TIME_TO_ANSWER: true
- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: PRs Opened in ${{ env.report_month }}
content-filepath: ./issue_metrics.md
prs_closed:
name: PRs Closed
needs: get_dates
steps:
- name: Run issue-metrics tool for PRs closed last month
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
SEARCH_QUERY: 'org:appwrite org:open-runtimes org:utopia-php is:pull-request closed:${{ env.last_month }}'
HIDE_TIME_TO_ANSWER: true
- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: PRs Closed in ${{ env.report_month }}
content-filepath: ./issue_metrics.md
# Discussions
discussions_opened:
name: Discussions Opened
needs: get_dates
steps:
- name: Run issue-metrics tool for discussions opened last month
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
SEARCH_QUERY: 'org:appwrite org:open-runtimes org:utopia-php type:discussions created:${{ env.last_month }}'
- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: Discussions Opened in ${{ env.report_month }}
content-filepath: ./issue_metrics.md
discussions_closed:
name: Discussions Closed
needs: get_dates
steps:
- name: Run issue-metrics tool for discussions closed last month
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
SEARCH_QUERY: 'org:appwrite org:open-runtimes org:utopia-php type:discussions closed:${{ env.last_month }}'
- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: Discussions Closed in ${{ env.report_month }}
content-filepath: ./issue_metrics.md