Skip to content

Commit 9ad3989

Browse files
committed
Get secret from GITHUB_EVENT_PATH to not leak
1 parent d99fe30 commit 9ad3989

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

action-runner/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ description: 'An action for publishing PRs'
44
inputs:
55
endpoint:
66
description: Endpoint to login
7-
required: true
7+
endpoint-input:
8+
description: If endpoint is not provided, it will be gotten from the input value with this name of the action
9+
default: endpoint
810

911
runs:
1012
using: node20

action-runner/dist/index.js

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

action-runner/src/main.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ export async function run() {
2323
}
2424
workspace = path.resolve(githubWorkspacePath)
2525

26-
const endpoint = core.getInput("endpoint")
26+
let endpoint = core.getInput("endpoint")
27+
if (!endpoint) {
28+
const json = JSON.parse(await fs.readFile(process.env['GITHUB_EVENT_PATH']!!, {encoding: 'utf8'}))
29+
endpoint = json.inputs[core.getInput('endpoint-input')]
30+
}
31+
2732
core.setSecret(endpoint)
2833
await setupWs(endpoint, onMessage)
2934
}

0 commit comments

Comments
 (0)