This repository provides a GitHub Action powered by Azure OpenAI to generate intelligent pull request (PR) descriptions, perform code reviews, and manage issues.
To use this GitHub Action in your repository, follow these steps:
Copy the workflow file from this repository located at .github/workflows/code-review.yml into your repository.
Go to your repository settings and add the following secrets:
GITHUB_TOKEN: Automatically provided by GitHub for workflows.AZURE_OPENAI_API_KEY: Your Azure OpenAI API key.AZURE_OPENAI_ENDPOINT: Your Azure OpenAI endpoint.AZURE_OPENAI_DEPLOYMENT: Your Azure OpenAI deployment name.
The workflow will automatically run on the following events:
- When a pull request is opened or synchronized.
- When manually triggered via the "Run workflow" button in the Actions tab.
The GitHub Action will generate an AI-powered PR description and update the pull request with the new description.
For more details, refer to the workflow file at .github/workflows/code-review.yml in this repository.
This repository is configured for development in a dev container.
When you open the project in a dev container, all dependencies are installed automatically, and Husky git hooks are set up via the postCreateCommand in .devcontainer/devcontainer.json.
You can generate a PR description without updating GitHub by running the action in "dry run" mode.
This is useful for previewing the generated description or saving it locally.
-
Copy
.env.sampleto.envand fill in the required values (see comments in the file). -
Run the script:
DRY_RUN=true node dist/index.js
- The generated PR description will be printed to the console and will not update the PR on GitHub.
- All other environment variables (GitHub/Azure credentials, PR info) are read from your
.envfile.
To run the test suite locally or in the dev container:
npm testTo check code style and lint for errors:
npm run lintA Husky pre-push hook is configured.
Before every git push, the following will run automatically:
npm run lintnpm testnpm run package
If any of these steps fail, the push will be aborted.
If you need to (re)install Husky hooks manually, run:
npm run prepareTo build and package the action (generates the dist/ directory):
npm run package
