This PHP project generates a CSV audit of all files modified across specified GitHub pull requests, including a list of contributors for each file.
- PHP 8.1 or higher
- Composer
- GitHub Personal Access Token (with at least
repoaccess for private repositories) - Jira API Access Token
- Git installed
- Clone the repository
git clone <your-repo-url>
cd <repo-folder> composer install cp ./config/.env.example ./config/.envEdit .env and set your GitHub token:
GITHUB_TOKEN=your_personal_access_token
cp ./config/epic_keys.json.example ./storage/epic_keys.jsonIf you already have a list of pull requests you can use the file below. Or let the extractPullRequestsFromJiraEpics script generate it for you instead.
cp ./config/repos_prs.json.example ./storage/repos_prs.jsonEdit ./config/repos_prs.json with your repository names and PR numbers in the following format:
{
"org/repo1": [12, 34],
"org/repo2": [7, 8, 9]
}
Run the audit scripts:
php extractPullRequestsFromJiraEpics.php #optional if you don't have your PR ids yet
php extractFileChangesFromPullRequests.phpThe latter script will fetch all files changed in the specified PRs and their contributors, then output a CSV file:
files_audit.csv
The CSV columns:
- Repo Name
- File Name
- Contributor 1
- Contributor 2
- ...
The number of contributor columns adjusts automatically based on how many contributors are detected per file.
- The project uses Guzzle for GitHub API requests.
- Environment variables are loaded using vlucas/phpdotenv.
- Output files (files_audit.csv) and input JSON (repos_prs.json) are ignored by .gitignore.
- If a file is modified in multiple PRs, contributors are merged to avoid duplicates.