{"id":22327451,"url":"https://github.com/rewindio/github-pr-auditor","last_synced_at":"2025-03-26T06:23:06.826Z","repository":{"id":207654380,"uuid":"689071804","full_name":"rewindio/github-pr-auditor","owner":"rewindio","description":"A continuous auditing system that examines pull requests using GitHub's search syntax","archived":false,"fork":false,"pushed_at":"2025-03-25T01:03:50.000Z","size":29,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-25T02:22:42.022Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/rewindio.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-08T18:21:56.000Z","updated_at":"2025-03-25T01:03:52.000Z","dependencies_parsed_at":"2024-02-12T16:53:57.912Z","dependency_job_id":"bc7ce4ce-8959-438c-b308-42aca762042b","html_url":"https://github.com/rewindio/github-pr-auditor","commit_stats":null,"previous_names":["rewindio/github-pr-auditor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fgithub-pr-auditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fgithub-pr-auditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fgithub-pr-auditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fgithub-pr-auditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rewindio","download_url":"https://codeload.github.com/rewindio/github-pr-auditor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245599573,"owners_count":20642126,"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":[],"created_at":"2024-12-04T03:09:28.961Z","updated_at":"2025-03-26T06:23:06.807Z","avatar_url":"https://github.com/rewindio.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub PR Auditor\n\nThis tool audits pull requests in order to determine whether or not they are considered compliant. This solution is geared more towards those that do not have access to the [Audit Log API](https://docs.github.com/en/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization#using-the-audit-log-api) (i.e. [non-Enterprise users](https://github.com/pricing)) or simply want a canned solution for searching for and alerting upon non-compliant pull requests.\n\nIf a pull request is found by `GITHUB_SEARCH_QUERY`, it will log it as a non-compliant pull request and provide a link to it.\n\n## Getting Started\n\n### Configuration\n\nThe following environment variables are required at runtime:\n\n| Variable            |                               Description                               |\n| ------------------- | :---------------------------------------------------------------------: |\n| AFTER_DATE          |    A date that follows the ISO8601 standard. Defaults to 1 day ago.     |\n| BEFORE_DATE         | A date that follows the ISO8601 standard. Defaults to the present time. |\n| GITHUB_API_TOKEN    |      A Github Personal Access Token (PAT) that has the repo scope.      |\n| GITHUB_ORG_NAME     |                      The GitHub Org name to scan.                       |\n| GITHUB_SEARCH_QUERY | The search query syntax. Defaults to `is:pr is:merged review:required`  |\n\nTo read more about how GitHub's search syntax works, see [understanding the search syntax](https://docs.github.com/en/github/searching-for-information-on-github/getting-started-with-searching-on-github/understanding-the-search-syntax).\n\n### Execution\n\nThis requires [ruby](https://www.ruby-lang.org/en/documentation/installation/) to be installed on your machine. It was tested on `Ruby 3.2.2`. Other versions may work.\n\n```shell\nbundler install\nGITHUB_API_TOKEN='\u003cINSERT-PAT-HERE\u003e' GITHUB_ORG_NAME='your-github-org' ./src/auditor.rb\n```\n\n## Deploy to AWS\n\nThe auditor can also be deployed to AWS via [aws-sam-cli](https://github.com/aws/aws-sam-cli). It requires an existing S3 bucket.\n\nIt works by running the auditor code in AWS Lambda on a schedule (Amazon CloudWatch Events), keeping track of the last successful run time in a Parameter Store parameter.\n\n![diagram](https://user-images.githubusercontent.com/4519234/122277304-bff67500-ceb3-11eb-8bfd-4ef8d3fa7e42.png)\n\nThis also includes CloudWatch Alarms that will alarm upon:\n\n- Any non-compliant pull request\n- Missing logs (if no logs appear for 24 hours)\n- Generic runtime errors\n\n### Requirements\n\n- [awscli](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html)\n- [aws-sam-cli](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)\n\n### Building\nNote that the SAM build uses Docker to ensure a matching platform architecture with the AWS lambda runtime.\nEnsure you have docker running before building the SAM application\n\n```shell\nmake build REGION=us-east-1\n```\n\n\n### Running the deploy script\n\nFor example, to deploy the CloudFormation stack:\n\n```sh\nmake deploy-staging \\\n  STACK_NAME=github-pr-auditor \\\n  BUCKET_NAME=my-sam-bucket \\\n  REGION=us-east-1 \\\n  SAM_PARAMS_PATH=sam-params/example.cfg\n```\n\n\n### Destroying\n\nTo destroy all of the resources provisioned:\n\n```sh\nmake destroy STACK_NAME=github-pr-auditor\n```\n\n## Development\n\n### Setup\n\nTo setup the dev environment, run:\n\n```sh\nbundle install --with development\npre-commit install # optional (requires pre-commit)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frewindio%2Fgithub-pr-auditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frewindio%2Fgithub-pr-auditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frewindio%2Fgithub-pr-auditor/lists"}