@@ -38,7 +38,7 @@ You may also want to use the **actions/add-to-project** workflow, which is maint
|
||||
For more information about authenticating in a {% data variables.product.prodname_actions %} workflow with a {% data variables.product.prodname_github_app %}, see "[AUTOTITLE](/apps/creating-github-apps/guides/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow)."
|
||||
|
||||
1. Create a {% data variables.product.prodname_github_app %} or choose an existing {% data variables.product.prodname_github_app %} owned by your organization. For more information, see "[AUTOTITLE](/apps/creating-github-apps/setting-up-a-github-app/creating-a-github-app)."
|
||||
2. Give your {% data variables.product.prodname_github_app %} read and write permissions to organization projects. For more information, see "[AUTOTITLE](/apps/maintaining-github-apps/editing-a-github-apps-permissions)."
|
||||
2. Give your {% data variables.product.prodname_github_app %} read and write permissions to organization projects. For this specific example, your {% data variables.product.prodname_github_app %} will also need read permissions to repository pull requests and repository issues. For more information, see "[AUTOTITLE](/apps/maintaining-github-apps/editing-a-github-apps-permissions)."
|
||||
|
||||
{% note %}
|
||||
|
||||
@@ -49,7 +49,7 @@ For more information about authenticating in a {% data variables.product.prodnam
|
||||
3. Install the {% data variables.product.prodname_github_app %} in your organization. Install it for all repositories that your project needs to access. For more information, see "[AUTOTITLE](/apps/maintaining-github-apps/installing-github-apps#installing-your-private-github-app-on-your-repository)."
|
||||
4. Store your {% data variables.product.prodname_github_app %}'s ID as a secret in your repository or organization. In the following workflow, replace `APP_ID` with the name of the secret. You can find your app ID on the settings page for your app or through the App API. For more information, see "[AUTOTITLE](/rest/apps#get-an-app)."
|
||||
5. Generate a private key for your app. Store the contents of the resulting file as a secret in your repository or organization. (Store the entire contents of the file, including `-----BEGIN RSA PRIVATE KEY-----` and `-----END RSA PRIVATE KEY-----`.) In the following workflow, replace `APP_PEM` with the name of the secret. For more information, see "[AUTOTITLE](/apps/creating-github-apps/authenticating-with-a-github-app/managing-private-keys-for-github-apps)."
|
||||
6. In the following workflow, replace `YOUR_ORGANIZATION` with the name of your organization. For example, `octo-org`. Replace `YOUR_PROJECT_NUMBER` with your project number. To find the project number, look at the project URL. For example, `https://github.com/orgs/octo-org/projects/5` has a project number of 5.
|
||||
6. In the following workflow, replace `YOUR_ORGANIZATION` with the name of your organization. For example, `octo-org`. Replace `YOUR_PROJECT_NUMBER` with your project number. To find the project number, look at the project URL. For example, `https://github.com/orgs/octo-org/projects/5` has a project number of 5. In order for this specific example to work, your project must also have a "Date posted" date field.
|
||||
|
||||
```yaml{:copy}
|
||||
{% data reusables.actions.actions-not-certified-by-github-comment %}
|
||||
|
||||
@@ -138,29 +138,37 @@ export async function getOpenApiSchemaFiles(schemas) {
|
||||
// The full list of dereferened OpenAPI schemas received from
|
||||
// bundling the OpenAPI in github/github
|
||||
const schemaNames = schemas.map((schema) => path.basename(schema, '.json'))
|
||||
|
||||
const OPENAPI_VERSION_NAMES = Object.keys(allVersions).map(
|
||||
(elem) => allVersions[elem].openApiVersionName
|
||||
)
|
||||
|
||||
for (const schema of schemaNames) {
|
||||
const schemaBasename = `${schema}.json`
|
||||
// catches all of the schemas that are not
|
||||
// calendar date versioned. Ex: ghec, ghes-3.7, and api.github.com
|
||||
// If the version doesn't have calendar date versioning
|
||||
// it should have an exact match with one of the versions defined
|
||||
// in the allVersions object.
|
||||
if (OPENAPI_VERSION_NAMES.includes(schema)) {
|
||||
webhookSchemas.push(schemaBasename)
|
||||
// Non-calendar date schemas could also match the calendar date versioned
|
||||
// counterpart.
|
||||
}
|
||||
|
||||
// If the schema version has calendar date versioning, then one of
|
||||
// the versions defined in allVersions should be a substring of the
|
||||
// schema version. This means the schema version is a supported version
|
||||
if (OPENAPI_VERSION_NAMES.some((elem) => schema.startsWith(elem))) {
|
||||
// If the schema being evaluated is a calendar-date version, then
|
||||
// there would only be one exact match in the list of schema names.
|
||||
// If the schema being evaluated is a non-calendar-date version, then
|
||||
// there will be two matches.
|
||||
// Ex: api.github.com would match api.github.com and
|
||||
// api.github.com.2022-09-09
|
||||
const filteredMatches = schemaNames.filter((elem) => elem.includes(schema))
|
||||
// If there is only one match then there are no calendar date counterparts
|
||||
// and this is the only schema for this plan and release.
|
||||
// If there is only one match then it's either a calendar-date version
|
||||
// or the version doesn't support calendar dates yet. We favor calendar-date
|
||||
// versions but default to non calendar-date versions.
|
||||
if (filteredMatches.length === 1) {
|
||||
restSchemas.push(schemaBasename)
|
||||
}
|
||||
// catches all of the calendar date versioned schemas in the
|
||||
// format api.github.com.<year>-<month>-<day>
|
||||
} else {
|
||||
restSchemas.push(schemaBasename)
|
||||
}
|
||||
}
|
||||
return { restSchemas, webhookSchemas }
|
||||
|
||||
Reference in New Issue
Block a user