Skip to content

contributor-report

contributor-report #6

name: contributor-report
on:
# Scheduled trigger
schedule:
# Run the first day of the month at 00:00
- cron: "0 0 1 * *"
# Manual trigger
workflow_dispatch:
permissions:
issues: none
jobs:
contributor-report:
runs-on: ubuntu-latest
strategy:
matrix:
# Define orgs to report contributor activity
org:
[
"bloomberg",
]
permissions:
# Required to create contributor report
issues: write
steps:
- name: 📅 calculate date
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 contributors action
uses: github/contributors@34fad9a6770332457ef52dfefc24a282ff47e929 # v1.5.10
env:
GH_TOKEN: ${{ secrets.BLOOMBERG_OSS_USER_TOKEN_READ }}
START_DATE: ${{ env.START_DATE }}
END_DATE: ${{ env.END_DATE }}
ORGANIZATION: ${{ matrix.org }}
LINK_TO_PROFILE: "True"
- name: 📥 create issue
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5.0.1
with:
title: "📰 Monthly Contributor Report: ${{ matrix.org }}"
token: ${{ secrets.BLOOMBERG_OSS_USER_TOKEN_READ }}
content-filepath: "./contributors.md"
assignees: ${{ github.actor }}