For this app to run the full weekly tag scan workflow, it must be allowed to open and modify pull requests. GitHub recommends using GitHub Apps for authentication, over Personal Access Tokens (PATs).
This App is essentially a more secure, drop-in replacement for a PAT. It is used to create a transient token with which the tag scan workflow can create or modify a PR (as per the tag grouping process). I mostly followed this guide while "creating" the App (registering it), but will outline the decisions based on GitHub's instructions for Registering a GitHub App for an Organization:
Note
Only Organization Owners can complete this process.
-
Navigate to
Organization settings > Developer settings > GitHub Apps -
Select "New GitHub App" and give it a descriptive name, e.g.,
ORGANIZATION_NAME Catalog Automation App. This way it will be unique across GitHub. -
Describe the App, for instance:
App for automated ORGANIZATION_NAME Catalog workflows (weekly tag-scan PR). -
Set the Homepage URL to your GitHub Organization (
https://github.com/ORGANIZATION_NAME)
Skip all remaining sections until you get to "Permissions":
-
Expand the Repository permissions section and set the required permissions, specifically:
- "Contents": "Read and write"
- "Pull requests": "Read and write"
- "Metadata" is set to "Read-only" by default. Do not touch this.
-
When asked "Where can this GitHub App be installed?", limit installation to your org by selecting "Only on this account".
-
Select "Create GitHub App".
Congratulations, you've made an App for authentication!
The App has no associated code, no webhooks, and is private within the Organization.
Follow GitHub's Instructions to install your App in your Org.
Important
During installation, be sure to choose "Only select repositories" under "Repository Access", then select your Catalog repository from the dropdown.
Now that the App is installed in your Org with access to your Catalog repository, you need to provide the repository with the means to authenticate your App. For this to work, the App Client ID must be stored as a variable and the App's private key as a secret. Together that will allow for the Authentication as an App, so the tag-scan PR is clearly automated.
Navigate to your GitHub App settings and generate a private key (GitHub's Instructions). This will automatically download a .pem file to your computer. Keep this secure; do not share it! (See also GitHub's recommendations for managing private keys.)
Before leaving this page, copy your App's "Client ID".
In your Catalog repository, navigate to Settings > Secrets and variables > Actions.
- Under the "Variables" Tab, create a new repository variable:
- Paste your App's Client ID into the "Value" box.
- Name the variable
APP_CLIENT_ID.
- Under "Secrets", create a new repository secret:
- Name it "APP_PRIVATE_KEY".
- Paste your private key in the "Secret" box. Be sure to include both the header (
-----BEGIN RSA PRIVATE KEY-----) and footer (-----END RSA PRIVATE KEY-----).
Important
Clear your clipboard after!