Pull request template status check
- Build with Maven - mvn clean install
- Create a testing repository - for start you can fork my
https://github.com/xstefank/test-repo where the PR template is set up or
you can create your own :)
- For creating new repository check the github manuals/help
- PRs needs to be created to YOUR repository, you need to specify it under the base fork field in the Open a Pull Request page
- The project requires two properties to be set up to run correctly
- GitHub OAuth token - can be passed as a
MicroProfile Config
property
tyr.github.oauth.token
- Configuration file specifying the format of the PR - the example can
be found in
tyr-runner/src/main/resources/format-example.yaml
, the supported MicroProfile Config properties aretyr.template.format.file
ortyr.template.format.url
- GitHub OAuth token - can be passed as a
MicroProfile Config
property
- start Tyr -
java -jar tyr-runner.jar
with above MP config properties set (as for instance system properties, e.g.-Dtyr.template.format.file=/path/to/file
) - Expose local server instance with ngrok - https://ngrok.com/
- Here you need to expose http port 8080 as the default application interface where the application runs, consult the ngrok documentation for the information of how to specify these arguments
- Now you should have everything prepared locally, next step is to let GitHub know where your Tyr instance runs
- Add a webhook for Tyr
- In you test-repo - go to Settings -> Webhooks -> Add webhook
- Fill in Payload URL -> your local exposed IP which is provided by ngrok + “/pull-request” (e. g., http://f202cf7c.ngrok.io/pull-request)
- Fill in Content type -> application/json
- Set Let me select individual events and check only Pull requests and Pull request review comments
- Leave Active set and click “Add webhook”
- Don’t worry about the error - the first JSON differs from what the subsequent PR JSONs will look like
- If you create a PR now (create a new branch based on master for instance)
you should already see some output in the server logs
- Be careful to which repository and branch you are doing the PR!!! You need to specify your repository, the point is to try to set up Tyr on your repository.
- However, you will still probably see problems with the custom PR check which the app is trying to send to GitHub as there is a requirement to provide an oauth token to the GitHub API
- Go to your profile -> settings (top right) -> Developer Settings -> Personal access tokens
- Generate new token
- Tick repo:status
- Generate token
- The last step is to let Tyr know what is the token value
- add the token to config.properties file (the example is provided in
the
tyr-runner/src/main/resources
folder) and copy this file to the same directory where Tyr is running
- add the token to config.properties file (the example is provided in
the
- Restart Tyr
- Rerun (update existing or create new PR) - everything should be working now
- If everything runs ok the PR should be updated with the valid error or green color, and in terminal where the server runs you’ll see Status update: 201
This project contains an openshift profile to be easily deployable to Openshift platform.
To deploy to Openshift:
- login to your OS account (
oc login
) mvn fabric8:deploy -Popenshift