Skip to content

Commit

Permalink
Merge pull request #24 from actions/decouple-telemetry
Browse files Browse the repository at this point in the history
Decouple telemetry API call from main action
  • Loading branch information
TooManyBees authored Mar 31, 2022
2 parents 0e15778 + 01f6ae5 commit eaf36f4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ description: 'A GitHub Action to deploy an artifact to GitHub Pages'
runs:
using: 'node16'
main: 'dist/index.js'
pre: 'pre/index.js'
inputs:
emit_telemetry:
description: 'Should this action only emit build telemetry instead of deploying the build artifact?'
required: false
token:
description: 'GitHub token'
default: ${{ github.token }}
Expand Down
10 changes: 9 additions & 1 deletion dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,12 @@ process.on('SIGINT', cancelHandler)
process.on('SIGTERM', cancelHandler)

// Main
main().then(() => require('./pre'))
const emitTelemetry = core.getInput("emit_telemetry")
if (emitTelemetry === "true") {
require('./pre')
} else if (emitTelemetry === "false") {
main()
} else {
// If emit_telemetry is not set, that indicates an older version of the dynamic workflow that doesn't separate telemetry from deployment
main().then(() => require('./pre'))
}

0 comments on commit eaf36f4

Please sign in to comment.