Skip to content

Commit 5cc811b

Browse files
authored
feat!: remove deprecated inputs (#213)
BREAKING CHANGE: Removed deprecated inputs (`app_id`, `private_key`, `skip_token_revoke`) and made `app-id` and `private-key` required in the action configuration.
1 parent 23b44b2 commit 5cc811b

8 files changed

+11
-77
lines changed

action.yml

+2-14
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,10 @@ branding:
77
inputs:
88
app-id:
99
description: "GitHub App ID"
10-
required: false # TODO: When 'app_id' is removed, make 'app-id' required
11-
app_id:
12-
description: "GitHub App ID"
13-
required: false
14-
deprecationMessage: "'app_id' is deprecated and will be removed in a future version. Use 'app-id' instead."
10+
required: true
1511
private-key:
1612
description: "GitHub App private key"
17-
required: false # TODO: When 'private_key' is removed, make 'private-key' required
18-
private_key:
19-
description: "GitHub App private key"
20-
required: false
21-
deprecationMessage: "'private_key' is deprecated and will be removed in a future version. Use 'private-key' instead."
13+
required: true
2214
owner:
2315
description: "The owner of the GitHub App installation (defaults to current repository owner)"
2416
required: false
@@ -28,10 +20,6 @@ inputs:
2820
skip-token-revoke:
2921
description: "If truthy, the token will not be revoked when the current job is complete"
3022
required: false
31-
skip_token_revoke:
32-
description: "If truthy, the token will not be revoked when the current job is complete"
33-
required: false
34-
deprecationMessage: "'skip_token_revoke' is deprecated and will be removed in a future version. Use 'skip-token-revoke' instead."
3523
# Make GitHub API configurable to support non-GitHub Cloud use cases
3624
# see https://github.com/actions/create-github-app-token/issues/77
3725
github-api-url:

lib/post.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
* @param {import("@octokit/request").request} request
66
*/
77
export async function post(core, request) {
8-
const skipTokenRevoke = Boolean(
9-
core.getInput("skip-token-revoke") || core.getInput("skip_token_revoke")
10-
);
8+
const skipTokenRevoke = Boolean(core.getInput("skip-token-revoke"));
119

1210
if (skipTokenRevoke) {
1311
core.info("Token revocation was skipped");
@@ -35,8 +33,7 @@ export async function post(core, request) {
3533
});
3634
core.info("Token revoked");
3735
} catch (error) {
38-
core.warning(
39-
`Token revocation failed: ${error.message}`)
36+
core.warning(`Token revocation failed: ${error.message}`);
4037
}
4138
}
4239

main.js

+4-14
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import core from "@actions/core";
44
import { createAppAuth } from "@octokit/auth-app";
55

6+
import { getPermissionsFromInputs } from "./lib/get-permissions-from-inputs.js";
67
import { main } from "./lib/main.js";
78
import request from "./lib/request.js";
8-
import { getPermissionsFromInputs } from "./lib/get-permissions-from-inputs.js";
99

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

18-
const appId = core.getInput("app-id") || core.getInput("app_id");
19-
if (!appId) {
20-
// 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.
21-
throw new Error("Input required and not supplied: app-id");
22-
}
23-
const privateKey = core.getInput("private-key") || core.getInput("private_key");
24-
if (!privateKey) {
25-
// 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.
26-
throw new Error("Input required and not supplied: private-key");
27-
}
18+
const appId = core.getInput("app-id");
19+
const privateKey = core.getInput("private-key");
2820
const owner = core.getInput("owner");
2921
const repositories = core
3022
.getInput("repositories")
3123
.split(/[\n,]+/)
3224
.map((s) => s.trim())
3325
.filter((x) => x !== "");
3426

35-
const skipTokenRevoke = Boolean(
36-
core.getInput("skip-token-revoke") || core.getInput("skip_token_revoke"),
37-
);
27+
const skipTokenRevoke = Boolean(core.getInput("skip-token-revoke"));
3828

3929
const permissions = getPermissionsFromInputs(process.env);
4030

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/main-missing-app-id.test.js

-9
This file was deleted.

tests/main-missing-private-key.test.js

-10
This file was deleted.

tests/snapshots/index.js.md

+1-23
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ Generated by [AVA](https://avajs.dev).
1212

1313
> stdout
1414
15-
`app_id — 'app_id' is deprecated and will be removed in a future version. Use 'app-id' instead.␊
16-
private_key — 'private_key' is deprecated and will be removed in a future version. Use 'private-key' instead.␊
17-
skip_token_revoke — 'skip_token_revoke' is deprecated and will be removed in a future version. Use 'skip-token-revoke' instead.`
15+
''
1816

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

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

42-
## main-missing-app-id.test.js
43-
44-
> stderr
45-
46-
'Input required and not supplied: app-id'
47-
48-
> stdout
49-
50-
''
51-
5240
## main-missing-owner.test.js
5341

5442
> stderr
@@ -59,16 +47,6 @@ Generated by [AVA](https://avajs.dev).
5947
6048
''
6149

62-
## main-missing-private-key.test.js
63-
64-
> stderr
65-
66-
'Input required and not supplied: private-key'
67-
68-
> stdout
69-
70-
''
71-
7250
## main-missing-repository.test.js
7351

7452
> stderr

tests/snapshots/index.js.snap

-162 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)