This repository provides an activity analysis tool that leverages GitHub Actions to evaluate merged pull requests and generate comprehensive reports via GitHub Issues. The tool compares data from the current period with that of the previous period, thus offering insights into repository activities.
To execute this action, you can set up a GitHub Actions workflow as shown below.
name: 'My Action'
on:
pull_request:
branches:
- main
jobs:
hello:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
repo: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
config_path: ${{ github.workspace }}/.github/config.yamlWhen a pull request is submitted against the main branch, this workflow automatically:
- Checks out the repository.
- Executes the custom action with the following inputs:
- repo: The repository in the format
owner/repo. - token: A GitHub authentication token (stored as
GITHUB_TOKENin Secrets). - config_path: The path to the configuration file (e.g.,
.github/config.yaml).
- repo: The repository in the format
-
Pull Request Analysis
- Aggregates the number of merged pull requests over a specified period.
- Provides per-user breakdowns with comparisons between the current and previous periods.
-
Report Generation
- Utilizes Mustache templates to render the report.
- Supports both English and Japanese templates based on the
langsetting in the configuration file.- When
langis set toja, it uses the Japanese template (src/export/templates/ja.mustache). - Otherwise, it defaults to the English template.
- When
- Automatically posts the generated report as a GitHub Issue.
-
Flexible Configuration
- Configure the report language (
lang), title (title), and period (period) in.github/config.yaml. - Supports period configurations for either the last one or two weeks, providing side-by-side comparisons between current and previous periods.
- Configure the report language (
- Trigger: The workflow is triggered by a pull request event.
- Checkout: The repository is checked out using
actions/checkout@v3. - Input Processing: The action reads and validates the inputs (repository, token, configuration path).
- Data Fetching: A GitHub API client is created, and pull request data is fetched and aggregated.
- Report Rendering: Mustache templates are used to format the report using the analysis data.
- Issue Creation: The final report is posted as a GitHub Issue automatically.