Appendix: RepoSense with Netlify

Note that Netlify has a low limit for free tier users (only 300 build minutes per month as at June 2020 -- a single report generation can take 2-3 build minutes, longer if your report includes many/big repositories).

Setting up

Step 1 Fork the publish-RepoSense repository using this link. Optionally, you can rename the fork to match your RepoSense report e.g., project-code-dashboard.

Step 2 Set up Netlify for your fork as described in this guide.
You will need to use the following in Step 5: Configure Your Settings of that guide:

  • build command: pip install requests && ./
  • publish directory: ./reposense-report

After Netlify finishes building the site, you should be able to see a dummy report at the URL of your Netlify site.

Step 3 Generate the report you want by updating the settings in your fork.

  1. Go to the file of your fork (on GitHub).
  2. Update the last line (i.e., the command for running RepoSense) to match the report you want to generate:
    java -jar RepoSense.jar --repos FULL_REPO_URL (assuming you want to generate a default report for just one repo)
    e.g., java -jar RepoSense.jar --repos (note the .git at the end of the repo URL)
  3. Commit the file. This will trigger Netlify to rebuild the report.
  4. Go to the URL of your Netlify site to see the updated RepoSense report (it might take about 2-5 minutes for Netlify to generate the report).

PR previews

After setting up Netlify for your repo containing RepoSense settings, when a PR comes in to that repo to update any setting, you can scroll down the PR page and in All checks have passed, click on the Details beside deploy/netlify — Deploy preview ready! to see a preview of the report as per the changes in the PR. Netlify Preview

Updating the report

Manual: Netlify UI has a way for you to trigger a build, using which you can cause the report to be updated.

Automated: Netlify's can be set up to update the report whenever a target repo of your report is updated, provided you are able to update the target repos in a certain way.

  1. Click on Settings in the top, choose Build & deploy from the left panel and scroll to Build hooks. Build hooks

  2. Click Add build hook, give your webhook a name, and choose the master branch to build. A Netlify URL will be generated.

  3. Go to your target repository (the repository you want to analyze) and click on Settings.

  4. Select Webhooks on left panel and click on Add webhook. Add webhook

  5. Copy the Netlify URL and paste it in the URL form field. Webhook url

    Note: Although the build url is not that secretive, it should be kept safe to prevent any misuse.

  6. Select application.json as content type.

  7. Select Let me select individual events and based on your requirements check the checkboxes.

  8. Leave the Active checkbox checked.

  9. Click on Add webhook to save the webhook and add it.