From 235833bd0f069bf03beece8596e89a508ca61374 Mon Sep 17 00:00:00 2001 From: Ben Evans <49054298+bsanevans@users.noreply.github.com> Date: Sat, 9 Dec 2023 15:55:44 +0900 Subject: [PATCH] Create monthly-contributor-report.yml (#2095) This workflow will create an issue each month, listing contributor info from the previous month. --- .../workflows/monthly-contributor-report.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/monthly-contributor-report.yml diff --git a/.github/workflows/monthly-contributor-report.yml b/.github/workflows/monthly-contributor-report.yml new file mode 100644 index 000000000..8df002db6 --- /dev/null +++ b/.github/workflows/monthly-contributor-report.yml @@ -0,0 +1,46 @@ +# Based on https://github.com/github/contributors/blob/main/README.md#example-workflow + +name: Monthly contributor report +on: + workflow_dispatch: + schedule: + - cron: '0 1 1 * *' + +permissions: + issues: write + +jobs: + contributor_report: + name: contributor report + runs-on: ubuntu-latest + + steps: + - name: Get dates for last month + shell: bash + run: | + # Calculate the first day of the previous month + start_date=$(date -d "last month" +%Y-%m-01) + + # Calculate the last day of the previous month + end_date=$(date -d "$start_date +1 month -1 day" +%Y-%m-%d) + + #Set an environment variable with the date range + echo "START_DATE=$start_date" >> "$GITHUB_ENV" + echo "END_DATE=$end_date" >> "$GITHUB_ENV" + + - name: Run contributor action + uses: github/contributors@v1 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + START_DATE: ${{ env.START_DATE }} + END_DATE: ${{ env.END_DATE }} + REPOSITORY: WordPress/Learn + + - name: Create issue + uses: peter-evans/create-issue-from-file@v4 + with: + title: Monthly contributor report + token: ${{ secrets.GITHUB_TOKEN }} + content-filepath: ./contributors.md + assignees: bsanevans +