cal-itp / benefits

Transit benefits enrollment, minus the paperwork.
https://docs.calitp.org/benefits
GNU Affero General Public License v3.0
27 stars 9 forks source link

Fix: allow mkdocs preview job to write comments on PRs #2091

Closed thekaveman closed 4 months ago

thekaveman commented 4 months ago

This permission is needed to allow the step that adds a comment with the preview URL

github-actions[bot] commented 4 months ago

Coverage report

This PR does not seem to contain any modification to coverable code.

github-actions[bot] commented 4 months ago

Preview url: https://benefits-2091--cal-itp-previews.netlify.app

thekaveman commented 4 months ago

Preview url: https://benefits-2091--cal-itp-previews.netlify.app

It works!

thekaveman commented 4 months ago

Just to make sure I understand, it was broken specifically for dependabot PRs right?

Yes this fix is related to Dependabot PRs.

There was a separate issue with Dependabot PRs not having access to the secrets (because there is a separate set of secrets specifically for Dependabot): https://github.com/cal-itp/benefits/pull/2087#pullrequestreview-2055535958

Once I fixed that, this issue came up where the workflow couldn't add the preview URL comment, and it was because of this missing permission: https://github.com/cal-itp/benefits/actions/runs/9070328822/job/24952931531#step:8:31

I think the GITHUB_TOKEN for Dependabot PRs is more limited by default: https://github.com/dependabot/dependabot-core/issues/3253#issuecomment-852541544.

For example we had a docs update back in April and the preview URL comment was added successfully: https://github.com/cal-itp/benefits/pull/2020#issuecomment-2050549616

angela-tran commented 4 months ago

I think the GITHUB_TOKEN for Dependabot PRs is more limited by default: dependabot/dependabot-core#3253 (comment).

For example we had a docs update back in April and the preview URL comment was added successfully: #2020 (comment)

Makes sense! I thought I had seen it work before, so this would explain the difference. Thanks 🙏