feat: add client-id input and deprecate app-id (#353)
GitHub now recommends using a GitHub App's Client ID for authentication.
This PR adds a first-class `client-id` input, keeps `app-id` available
for compatibility, and makes the migration path explicit in both runtime
behavior and documentation.
### Action inputs
- Adds a new `client-id` input
- Removes `required` from `app-id`
- Marks `app-id` as deprecated in `action.yml`
### Runtime behavior
- Updates input parsing to prefer `client-id`
- Falls back to `app-id` for existing workflows
- Adds a clear error when neither `client-id` nor `app-id` is provided
### Docs
- Updates the README to recommend `client-id`
- Switches usage examples to `client-id`
- Documents that `app-id` is deprecated and that `client-id` takes
precedence if both are set
### Regression coverage
- Adds a focused test proving a client-ID-shaped value works through the
new `client-id` input
- Adds coverage for the missing-ID validation path
- Updates snapshots to lock in the new metadata and runtime behavior
### Resulting usage
Users can migrate to the new input name directly:
```yaml
- uses: actions/create-github-app-token@v3
with:
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: parkerbxyz <17183625+parkerbxyz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
11
dist/main.cjs
vendored
11
dist/main.cjs
vendored
@@ -23153,7 +23153,7 @@ async function pRetry(input, options = {}) {
|
||||
}
|
||||
|
||||
// lib/main.js
|
||||
async function main(appId, privateKey, owner, repositories, permissions, core, createAppAuth2, request2, skipTokenRevoke) {
|
||||
async function main(clientId, privateKey, owner, repositories, permissions, core, createAppAuth2, request2, skipTokenRevoke) {
|
||||
let parsedOwner = "";
|
||||
let parsedRepositoryNames = [];
|
||||
if (!owner && repositories.length === 0) {
|
||||
@@ -23188,7 +23188,7 @@ async function main(appId, privateKey, owner, repositories, permissions, core, c
|
||||
);
|
||||
}
|
||||
const auth5 = createAppAuth2({
|
||||
appId,
|
||||
appId: clientId,
|
||||
privateKey,
|
||||
request: request2
|
||||
});
|
||||
@@ -23307,14 +23307,17 @@ if (!process.env.GITHUB_REPOSITORY_OWNER) {
|
||||
}
|
||||
async function run() {
|
||||
ensureNativeProxySupport();
|
||||
const appId = getInput("app-id");
|
||||
const clientId = getInput("client-id") || getInput("app-id");
|
||||
if (!clientId) {
|
||||
throw new Error("Either 'client-id' or 'app-id' input must be set");
|
||||
}
|
||||
const privateKey = getInput("private-key");
|
||||
const owner = getInput("owner");
|
||||
const repositories = getInput("repositories").split(/[\n,]+/).map((s) => s.trim()).filter((x) => x !== "");
|
||||
const skipTokenRevoke = getBooleanInput("skip-token-revoke");
|
||||
const permissions = getPermissionsFromInputs(process.env);
|
||||
return main(
|
||||
appId,
|
||||
clientId,
|
||||
privateKey,
|
||||
owner,
|
||||
repositories,
|
||||
|
||||
Reference in New Issue
Block a user