Skip to content

Commit

Permalink
feat(outputs): set pipeline POST response data as GitHub Action outpu…
Browse files Browse the repository at this point in the history
…ts (#47)
  • Loading branch information
whatisdot authored Mar 23, 2023
1 parent 7232fb1 commit 0e4a095
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ jobs:
CCI_TOKEN: ${{ secrets.CCI_TOKEN }}
```

# Outputs

Field | Data Type | Description
-- | -- | --
`id` | string (uuid) | The unique ID of the pipeline.
`state` | string (Enum: "created" "errored" "setup-pending" "setup" "pending") | The current state of the pipeline.
`number` | integer (int64) | The number of the pipeline.
`created_at` | string (date-time) | The date and time the pipeline was created.

# Things To Know

## GitHub Actions runs _alongside_ native CircleCI integration.
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ inputs:
GHA_Meta:
required: false
description: 'An optional additional metadata parameter. Will be available on the CircleCI pipeline as GHA_Meta'
outputs:
id:
description: The unique ID of the pipeline.
state:
description: The current state of the pipeline.
number:
description: The number of the pipeline.
created_at:
description: The date and time the pipeline was created.
runs:
using: 'node16'
main: 'dist/index.js'
4 changes: 4 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16558,6 +16558,10 @@ axios__WEBPACK_IMPORTED_MODULE_2___default().post(url, body, { headers: headers
.then((response) => {
(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.startGroup)("Successfully triggered CircleCI Pipeline");
(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.info)(`CircleCI API Response: ${JSON.stringify(response.data)}`);
(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput)("created_at", response.data.created_at);
(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput)("id", response.data.id);
(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput)("number", response.data.number);
(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput)("state", response.data.state);
(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.endGroup)();
})
.catch((error) => {
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
getInput,
setFailed,
setOutput,
startGroup,
endGroup,
info,
Expand Down Expand Up @@ -81,6 +82,10 @@ axios
.then((response) => {
startGroup("Successfully triggered CircleCI Pipeline");
info(`CircleCI API Response: ${JSON.stringify(response.data)}`);
setOutput("created_at", response.data.created_at);
setOutput("id", response.data.id);
setOutput("number", response.data.number);
setOutput("state", response.data.state);
endGroup();
})
.catch((error) => {
Expand Down

0 comments on commit 0e4a095

Please sign in to comment.