Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Commit c598664

Browse files
authored
fix: ensure token is masked (#4)
* fix: ensure token is masked * chore: use github action token for dry run release.
1 parent e4ccc0a commit c598664

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
- name: Dry run release
5555
env:
56-
GITHUB_TOKEN: ${{ steps.app.outputs.token }}
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5757
run: yarn && yarn run release -d -b ${{ steps.branch.outputs.short_ref }}
5858

5959
- name: Release

dist/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15302,7 +15302,7 @@ const getAppInstallationToken = (privateKey, appId, org) => __awaiter(void 0, vo
1530215302
});
1530315303
exports.getAppInstallationToken = getAppInstallationToken;
1530415304
const getToken = (parameters) => __awaiter(void 0, void 0, void 0, function* () {
15305-
let token = undefined;
15305+
let token;
1530615306
const privateKey = Buffer.from(parameters.base64PrivateKey, 'base64').toString();
1530715307
switch (parameters.type) {
1530815308
case 'installation': {
@@ -15374,6 +15374,8 @@ function run() {
1537415374
type: authType,
1537515375
org,
1537615376
});
15377+
// some github magic seems masking the token by default, but just to ensure it is registered as secret.
15378+
core.setSecret(token);
1537715379
core.setOutput('token', token);
1537815380
}
1537915381
catch (error) {

src/auth.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const getAppInstallationToken = async (privateKey: string, appId: number,
4444
}
4545
};
4646

47-
export const getToken = async (parameters: Parameters): Promise<string | undefined> => {
48-
let token = undefined;
47+
export const getToken = async (parameters: Parameters): Promise<string> => {
48+
let token: string;
4949

5050
const privateKey = Buffer.from(parameters.base64PrivateKey, 'base64').toString();
5151
switch (parameters.type) {
@@ -58,5 +58,6 @@ export const getToken = async (parameters: Parameters): Promise<string | undefin
5858
break;
5959
}
6060
}
61+
6162
return token;
6263
};

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ async function run(): Promise<void> {
1919
org,
2020
});
2121

22+
// some github magic seems masking the token by default, but just to ensure it is registered as secret.
23+
core.setSecret(token);
2224
core.setOutput('token', token);
2325
} catch (error) {
2426
core.debug(error);

0 commit comments

Comments
 (0)