{"id":25762311,"url":"https://github.com/aternus/generate-pr-description","last_synced_at":"2025-06-28T13:32:11.785Z","repository":{"id":177833354,"uuid":"660981539","full_name":"Aternus/generate-pr-description","owner":"Aternus","description":"10x Devs: Automating PR Descriptions","archived":false,"fork":false,"pushed_at":"2023-11-02T07:01:23.000Z","size":27,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T19:42:17.122Z","etag":null,"topics":["automation","pull-request"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Aternus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-01T12:13:22.000Z","updated_at":"2024-03-26T13:30:19.000Z","dependencies_parsed_at":"2023-11-02T08:27:02.764Z","dependency_job_id":null,"html_url":"https://github.com/Aternus/generate-pr-description","commit_stats":null,"previous_names":["aternus/pull-request-description"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Aternus/generate-pr-description","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aternus%2Fgenerate-pr-description","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aternus%2Fgenerate-pr-description/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aternus%2Fgenerate-pr-description/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aternus%2Fgenerate-pr-description/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aternus","download_url":"https://codeload.github.com/Aternus/generate-pr-description/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aternus%2Fgenerate-pr-description/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262438004,"owners_count":23311069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","pull-request"],"created_at":"2025-02-26T19:40:05.420Z","updated_at":"2025-06-28T13:32:11.767Z","avatar_url":"https://github.com/Aternus.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generate Pull Request (PR) Description\n\n**10x Devs: Automating PR Descriptions**\n\nThis repository hosts a Bash script that generates a pull request (PR)\ndescription based on the commit history of a branch in a Git repository. The\nscript extracts commit messages, filters them by the current Git user, and\nprocesses them to create a changelog-like PR description.\n\n## Prerequisites\n\n- Bash (Bourne Again SHell) should be installed on your system.\n\n## Usage\n\n1. Clone or download the repository.\n2. Navigate to the repository's directory.\n\n```bash\n$ git clone https://github.com/Aternus/generate-pr-description.git\n$ cd generate-pr-description\n```\n\n3. Make the Bash script executable.\n\n```bash\n$ chmod +x generate-pr-description.sh\n```\n\n4. Add the script to the `$PATH` environment variable to enable running it from\n   any directory. This can be done by creating a symbolic link in a directory\n   that is already in the `$PATH`.\n\n```bash\n$ ln -s \"$PWD/generate-pr-description.sh\" /usr/local/bin/generate-pr-description\n```\n\nNow you can run the script from any directory using its name.\n\n```bash\n$ generate-pr-description\n```\n\n## How it Works\n\nThis bash script generates a neatly formatted changelog from the commit history\nof a Git repository, specifically targeting commits made by the user running the\nscript. The script will not work if run outside a Git repository or if\nthere's no master or main branch available.\n\nLet's break down the working of the script:\n\n1. **Check for Git repository**: The script first checks if the current\n   directory is part of a Git repository.\n\n2. **Temporary File**: The script creates a temporary file to store the filtered\n   commit messages.\n\n3. **Git User Information**: The script retrieves the name and email of the\n   current Git user.\n\n4. **Main Branch Check**: The script checks what is the primary branch of the\n   repository.\n\n5. **Diverged Commit**: The script determines the commit where the current\n   branch diverged from the main branch.\n\n6. **Commit Messages**: The script extracts all commit messages made by the\n   current Git user after the divergence from the main branch.\n\n7. **Processing Commit Messages**: The script then processes each commit message\n   one by one. Merge commit messages are skipped.\n\n8. **Generate Changelog**: The script generates a changelog by sorting and\n   removing duplicates from the commit messages stored in the temporary file.\n   The changelog groups commit messages by their prefixes and tasks, and prints\n   them under their respective headers. Only details that are not the same as\n   the task are printed as list items.\n\n9. **Clean Up**: Finally, the script deletes the temporary file to clean up.\n\nPlease note that the script expects commit messages to follow a specific\nformat (like `prefix: task - details`). If your commit messages do not follow\nthis format, the script may not work as expected.\n\n### Example\n\n#### Input\n\nAssume we have the following commit messages in the branch since it diverged\nfrom the master:\n\n```\n- added a detail - then added another detail - but forgot to add prefix and task!\nCHORE: added just the prefix and the task\n- forgot to add the prefix and the task\ndid something quick via GitHub UI\nFIX: another thingy - fixed an edge case that we missed last time\nFEAT: something awesome - created the skeleton - created the tests\n```\n\n#### Output\n\nWhen running the script, it will generate the following PR description:\n\n```markdown\n# Changelog\n\n## CHORE: added just the prefix and the task\n\n## CHORE: other\n- added a detail\n- but forgot to add prefix and task!\n- did something quick via GitHub UI\n- forgot to add the prefix and the task\n- then added another detail\n\n## FEAT: something awesome\n- created the skeleton\n- created the tests\n\n## FIX: another thingy\n- fixed an edge case that we missed last time\n```\n\n## Contributing\n\nContributions to this repository are welcome. Feel free to open issues or submit\npull requests to suggest improvements, report bugs, or add new features.\n\nFor collaborations, please reach out\nvia [LinkedIn](https://www.linkedin.com/in/kirilreznik/).\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternus%2Fgenerate-pr-description","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faternus%2Fgenerate-pr-description","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternus%2Fgenerate-pr-description/lists"}