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

Replace obsolete 'Generate Token' step, thanks to improved Scala Steward GitHub Action support #46

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/public-repos-scala-steward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ jobs:
uses: ./.github/workflows/reusable-scala-steward.yml
with:
app_id: 214238
app_installation_id: 26822732
Copy link
Member Author

@rtyley rtyley Jun 2, 2023

Choose a reason for hiding this comment

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

One surprise here is that with moving from tibdex/github-app-token to scala-steward-org/scala-steward-action for App authentication, we now need to also supply the github-app-installation-id, where previously we didn't.

In the Scala Steward action, both 'app' & 'installation' tokens seem to get used - so far as I can see, the 'app' is used for performing actions as the bot, while 'installation' is used for in the Scala Steward workspace - I think for cloning the required GitHub repos.

In our case, because we own both the app and the installation, the distinction probably doesn't help us very much, but I imagine it's useful if you're an organisation like VirtusLab, who run Scala Steward on other organisations repositories as a service.

secrets:
private_key: ${{ secrets.SCALA_STEWARD_APP_PRIVATE_KEY }}
17 changes: 7 additions & 10 deletions .github/workflows/reusable-scala-steward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
app_id:
required: true
type: string
app_installation_id:
required: true
type: string
secrets:
private_key:
required: true
Expand All @@ -22,19 +25,13 @@ jobs:
with:
repository: guardian/scala-steward-public-repos
path: common-config
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ inputs.app_id }}
private_key: ${{ secrets.private_key }}

- name: Execute Scala Steward
uses: scala-steward-org/[email protected]

with:
# Use the token generated by the previous step and the
# Guardian Scala Steward GitHub App
github-token: ${{ steps.generate-token.outputs.token }}
repos-file: REPOSITORIES.md
github-app-id: ${{ inputs.app_id }}
github-app-installation-id: ${{ inputs.app_installation_id }}
github-app-key: ${{ secrets.private_key }}
repos-file: REPOSITORIES.md # possibly no longer necessary, thanks to `github-app-*` configuration
repo-config: common-config/scala-steward.conf # from checkout of guardian/scala-steward-public-repos
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ instead!_

## How to add a new *public* repo for scanning by Scala Steward

1. Add your repo to the list in [REPOSITORIES.md](REPOSITORIES.md)
2. Request to [install our GitHub app](https://github.com/apps/gu-scala-steward-public-repos) on your repo
* **Grant [our GitHub app](https://github.com/apps/gu-scala-steward-public-repos) access to your repo** (click
[`Configure`](https://github.com/organizations/guardian/settings/installations/26822732) - you may need
a repo admin to do this)
* You can check if the app is installed on your repo by examining `/settings/installations`
(eg https://github.com/guardian/amigo/settings/installations):
![image](https://github.com/guardian/scala-steward-public-repos/assets/52038/9b7dc7b7-a6fc-46d6-b313-a4ae97d5d3ad)
* Only add your repo to `REPOSITORIES.md` if you're specifying a non-default branch to update (after
PR [#40](https://github.com/guardian/scala-steward-public-repos/pull/40) this is probably no longer needed).

This repo (`scala-steward-public-repos`) is public, so the GitHub Action minutes are
[free](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
Expand Down
34 changes: 5 additions & 29 deletions REPOSITORIES.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
# Our Scala Steward GitHub Action will run on any repo that our GitHub App is granted access to.
#
# You only need to add your repo to *this* file if you're specifying a non-default branch to update.
# Thanks to https://github.com/guardian/scala-steward-public-repos/pull/40 this is probably no longer necessary!

- guardian/amiable:dependency-updates_1
- guardian/amigo:dependency-updates
- guardian/amiup
- guardian/apps-rendering-api-models
- guardian/discussion-avatar
- guardian/google-search-indexing-observatory
- guardian/grid-feeds
- guardian/gu-who
- guardian/identity-processes
- guardian/invoicing-api
- guardian/janus-app:dependency-updates
- guardian/manage-help-content-publisher
- guardian/marley
- guardian/members-data-api
- guardian/membership-common
- guardian/membership-frontend
- guardian/mobile-n10n
- guardian/ophan-geoip-db-refresher
- guardian/ophan-housekeeper
- guardian/pa-football-client
- guardian/payment-failure-comms
- guardian/play-googleauth
- guardian/play-secret-rotation
- guardian/price-migration-engine
- guardian/prism:dependency-updates
- guardian/prout
- guardian/repo-genesis
- guardian/riff-raff:dependency-updates
- guardian/salesforce-message-handler
- guardian/security-hq:dependency-updates
- guardian/ssm-scala:dependency-updates
- guardian/support-frontend
- guardian/support-service-lambdas
- guardian/typerighter
- guardian/zuora-6for6-modifier
- guardian/zuora-full-export