Skip to content

Commit eaf36f4

Browse files
authored
Merge pull request #24 from actions/decouple-telemetry
Decouple telemetry API call from main action
2 parents 0e15778 + 01f6ae5 commit eaf36f4

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ description: 'A GitHub Action to deploy an artifact to GitHub Pages'
33
runs:
44
using: 'node16'
55
main: 'dist/index.js'
6-
pre: 'pre/index.js'
76
inputs:
7+
emit_telemetry:
8+
description: 'Should this action only emit build telemetry instead of deploying the build artifact?'
9+
required: false
810
token:
911
description: 'GitHub token'
1012
default: ${{ github.token }}

dist/index.js

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

dist/index.js.map

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

src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,12 @@ process.on('SIGINT', cancelHandler)
5252
process.on('SIGTERM', cancelHandler)
5353

5454
// Main
55-
main().then(() => require('./pre'))
55+
const emitTelemetry = core.getInput("emit_telemetry")
56+
if (emitTelemetry === "true") {
57+
require('./pre')
58+
} else if (emitTelemetry === "false") {
59+
main()
60+
} else {
61+
// If emit_telemetry is not set, that indicates an older version of the dynamic workflow that doesn't separate telemetry from deployment
62+
main().then(() => require('./pre'))
63+
}

0 commit comments

Comments
 (0)