Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip “Percy screenshots” when secrets are unavailable on forks #3028

Merged
merged 2 commits into from
Nov 21, 2022

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Nov 21, 2022

The Percy CLI requires ${{ secrets.PERCY_TOKEN }} which forks won't necessarily have. We recently made our Percy npm script return an error code when the health check failed in:

This PR adds a condition to our Send screenshots to Percy job which makes it skippable

# Skip when secrets are unavailable on forks
if: ${{ github.repository_owner == 'alphagov' }}

Where permissions allow you'll see we've now added a Dependabot PERCY_TOKEN secret too:
https://github.com/alphagov/govuk-frontend/settings/secrets/dependabot

Reducing Percy runs in future

We may want to consider a "paths" filter in future so this PR also moves the Percy uploads to a separate GitHub Actions .github/workflows/screenshots.yml workflow. More information in:

@colinrotherham colinrotherham added 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) Frontend squad labels Nov 21, 2022
@colinrotherham colinrotherham requested a review from a team as a code owner November 21, 2022 14:29
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3028 November 21, 2022 14:30 Inactive
@@ -162,26 +162,10 @@ jobs:
run: ${{ matrix.run }}

regression:
name: Send screenshots to Percy
runs-on: ubuntu-latest
name: Percy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any benefit to having this inside the tests workflow, rather than just having screenshots.yml trigger on the same pull_request and push events?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it gives the Install and Build steps chance to get cached

Then when we trigger the Percy workflow it can go super fast (already installed and built)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense – but I think this might be worth adding as a comment somewhere as it's not obvious.

Copy link
Contributor Author

@colinrotherham colinrotherham Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, comment added

Similar to how we only install js-beautify in the Diff changes to dist workflow it would be nice in future (we're nearly there) to just install Percy with the Review app devDependencies:

npm ci --workspace app

@colinrotherham colinrotherham force-pushed the percy-secret-permissions branch from c2b4e04 to 7a81c8c Compare November 21, 2022 16:06
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3028 November 21, 2022 16:06 Inactive
@colinrotherham colinrotherham merged commit 2bb03d5 into main Nov 21, 2022
@colinrotherham colinrotherham deleted the percy-secret-permissions branch November 21, 2022 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation)
Projects
Development

Successfully merging this pull request may close these issues.

3 participants