Skip to content

Commit

Permalink
Add runId as an output (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
skwon615 authored Oct 31, 2022
1 parent 150cfe4 commit e845771
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ inputs:
outputs:
git_sha:
description: "Repository SHA in which dbt Cloud Job ran"
run_id:
description: "Run ID of the dbt Cloud Job that was triggered"
runs:
using: node16
main: "index.js"
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,24 @@ async function executeAction() {

await getArtifacts(account_id, runId);

return res.data['git_sha'];
const outputs = {
"git_sha": res.data['git_sha'],
"run_id": runId
};

return outputs;
}

async function main() {
try {
const git_sha = await executeAction();
const outputs = await executeAction();
const git_sha = outputs["git_sha"];
const run_id = outputs["run_id"];

// GitHub Action output
core.info(`dbt Cloud Job commit SHA is ${git_sha}`)
core.setOutput('git_sha', git_sha);
core.setOutput('run_id', run_id);
} catch (e) {
// Always fail in this case because it is not a dbt error
core.setFailed('There has been a problem with running your dbt cloud job:\n' + e.toString());
Expand Down

0 comments on commit e845771

Please sign in to comment.