diff --git a/README.md b/README.md index b57c702..fc4eced 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,11 @@ GitHub Action for creating a GitHub App installation access token. In order to use this action, you need to: 1. [Register new GitHub App](https://docs.github.com/apps/creating-github-apps/setting-up-a-github-app/creating-a-github-app). -2. [Store the App's ID or Client ID in your repository environment variables](https://docs.github.com/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows) (example: `APP_ID`). +2. [Store the App's Client ID (recommended) or App ID in your repository environment variables](https://docs.github.com/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows) (example: `APP_ID`). 3. [Store the App's private key in your repository secrets](https://docs.github.com/actions/security-guides/encrypted-secrets?tool=webui#creating-encrypted-secrets-for-a-repository) (example: `PRIVATE_KEY`). +Pass the App's Client ID or App ID using the `app-id` input. GitHub recommends using the Client ID when available. + > [!IMPORTANT] > An installation access token expires after 1 hour. Please [see this comment](https://github.com/actions/create-github-app-token/issues/121#issuecomment-2043214796) for alternative approaches if you have long-running processes. @@ -318,7 +320,7 @@ If you set `HTTP_PROXY` or `HTTPS_PROXY`, also set `NODE_USE_ENV_PROXY: "1"` on ### `app-id` -**Required:** GitHub App ID. +**Required:** GitHub App Client ID or App ID. GitHub recommends using the Client ID when available. ### `private-key` diff --git a/action.yml b/action.yml index ba4e915..e614e7e 100644 --- a/action.yml +++ b/action.yml @@ -6,7 +6,7 @@ branding: color: "gray-dark" inputs: app-id: - description: "GitHub App ID" + description: "GitHub App ID or Client ID" required: true private-key: description: "GitHub App private key" diff --git a/tests/index.js.snapshot b/tests/index.js.snapshot index 06cac80..e230cee 100644 --- a/tests/index.js.snapshot +++ b/tests/index.js.snapshot @@ -1,3 +1,20 @@ +exports[`main-client-id.test.js > stdout 1`] = ` +Inputs 'owner' and 'repositories' are not set. Creating token for this repository (actions/create-github-app-token). +::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a + +::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a + +::set-output name=installation-id::123456 + +::set-output name=app-slug::github-actions +::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a +::save-state name=expiresAt::2016-07-11T22:14:10Z +--- REQUESTS --- +GET /repos/actions/create-github-app-token/installation +POST /app/installations/123456/access_tokens +{"repositories":["create-github-app-token"]} +`; + exports[`main-custom-github-api-url.test.js > stdout 1`] = ` Inputs 'owner' and 'repositories' are set. Creating token for the following repositories: diff --git a/tests/main-client-id.test.js b/tests/main-client-id.test.js new file mode 100644 index 0000000..7af6c91 --- /dev/null +++ b/tests/main-client-id.test.js @@ -0,0 +1,6 @@ +import { test } from "./main.js"; + +// Verify `main` accepts a GitHub App client ID via the `app-id` input +await test(() => { + process.env["INPUT_APP-ID"] = "Iv1.0123456789abcdef"; +});