• HOME
  • SHOWCASE
  • USER GUIDE
  • DEVELOPER GUIDE
  • ABOUT
  • CONTACT
  • 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

    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.

    2. Set up Netlify for your fork as described in this guide.
      You will need to use the following in step 5:

      • build command: pip install requests && ./run.sh
      • 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.

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

      1. Go to the run.sh 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 https://github.com/reposense/RepoSense.git (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.

    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.

    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.

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

      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.