Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(outputs): set pipeline POST response data as GitHub Action outputs #47

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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