Skip to content

feat!: remove deprecated inputs #213

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

Merged
merged 6 commits into from
Apr 3, 2025
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
16 changes: 2 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@ branding:
inputs:
app-id:
description: "GitHub App ID"
required: false # TODO: When 'app_id' is removed, make 'app-id' required
app_id:
description: "GitHub App ID"
required: false
deprecationMessage: "'app_id' is deprecated and will be removed in a future version. Use 'app-id' instead."
required: true
private-key:
description: "GitHub App private key"
required: false # TODO: When 'private_key' is removed, make 'private-key' required
private_key:
description: "GitHub App private key"
required: false
deprecationMessage: "'private_key' is deprecated and will be removed in a future version. Use 'private-key' instead."
required: true
owner:
description: "The owner of the GitHub App installation (defaults to current repository owner)"
required: false
Expand All @@ -28,10 +20,6 @@ inputs:
skip-token-revoke:
description: "If truthy, the token will not be revoked when the current job is complete"
required: false
skip_token_revoke:
description: "If truthy, the token will not be revoked when the current job is complete"
required: false
deprecationMessage: "'skip_token_revoke' is deprecated and will be removed in a future version. Use 'skip-token-revoke' instead."
# Make GitHub API configurable to support non-GitHub Cloud use cases
# see https://github.com/actions/create-github-app-token/issues/77
github-api-url:
Expand Down
7 changes: 2 additions & 5 deletions lib/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
* @param {import("@octokit/request").request} request
*/
export async function post(core, request) {
const skipTokenRevoke = Boolean(
core.getInput("skip-token-revoke") || core.getInput("skip_token_revoke")
);
const skipTokenRevoke = Boolean(core.getInput("skip-token-revoke"));

if (skipTokenRevoke) {
core.info("Token revocation was skipped");
Expand Down Expand Up @@ -35,8 +33,7 @@ export async function post(core, request) {
});
core.info("Token revoked");
} catch (error) {
core.warning(
`Token revocation failed: ${error.message}`)
core.warning(`Token revocation failed: ${error.message}`);
}
}

Expand Down
18 changes: 4 additions & 14 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import core from "@actions/core";
import { createAppAuth } from "@octokit/auth-app";

import { getPermissionsFromInputs } from "./lib/get-permissions-from-inputs.js";
import { main } from "./lib/main.js";
import request from "./lib/request.js";
import { getPermissionsFromInputs } from "./lib/get-permissions-from-inputs.js";

if (!process.env.GITHUB_REPOSITORY) {
throw new Error("GITHUB_REPOSITORY missing, must be set to '<owner>/<repo>'");
Expand All @@ -15,26 +15,16 @@ if (!process.env.GITHUB_REPOSITORY_OWNER) {
throw new Error("GITHUB_REPOSITORY_OWNER missing, must be set to '<owner>'");
}

const appId = core.getInput("app-id") || core.getInput("app_id");
if (!appId) {
// The 'app_id' input was previously required, but it and 'app-id' are both optional now, until the former is removed. Still, we want to ensure that at least one of them is set.
throw new Error("Input required and not supplied: app-id");
}
const privateKey = core.getInput("private-key") || core.getInput("private_key");
if (!privateKey) {
// The 'private_key' input was previously required, but it and 'private-key' are both optional now, until the former is removed. Still, we want to ensure that at least one of them is set.
throw new Error("Input required and not supplied: private-key");
}
const appId = core.getInput("app-id");
const privateKey = core.getInput("private-key");
const owner = core.getInput("owner");
const repositories = core
.getInput("repositories")
.split(/[\n,]+/)
.map((s) => s.trim())
.filter((x) => x !== "");

const skipTokenRevoke = Boolean(
core.getInput("skip-token-revoke") || core.getInput("skip_token_revoke"),
);
const skipTokenRevoke = Boolean(core.getInput("skip-token-revoke"));

const permissions = getPermissionsFromInputs(process.env);

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions tests/main-missing-app-id.test.js

This file was deleted.

10 changes: 0 additions & 10 deletions tests/main-missing-private-key.test.js

This file was deleted.

24 changes: 1 addition & 23 deletions tests/snapshots/index.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ Generated by [AVA](https://avajs.dev).

> stdout

`app_id — 'app_id' is deprecated and will be removed in a future version. Use 'app-id' instead.␊
private_key — 'private_key' is deprecated and will be removed in a future version. Use 'private-key' instead.␊
skip_token_revoke — 'skip_token_revoke' is deprecated and will be removed in a future version. Use 'skip-token-revoke' instead.`
''

## main-custom-github-api-url.test.js

Expand All @@ -39,16 +37,6 @@ Generated by [AVA](https://avajs.dev).
POST /api/v3/app/installations/123456/access_tokens␊
{"repositories":["create-github-app-token"]}`

## main-missing-app-id.test.js

> stderr

'Input required and not supplied: app-id'

> stdout

''

## main-missing-owner.test.js

> stderr
Expand All @@ -59,16 +47,6 @@ Generated by [AVA](https://avajs.dev).

''

## main-missing-private-key.test.js

> stderr

'Input required and not supplied: private-key'

> stdout

''

## main-missing-repository.test.js

> stderr
Expand Down
Binary file modified tests/snapshots/index.js.snap
Binary file not shown.