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

Conversation

whatisdot
Copy link
Contributor

@whatisdot whatisdot commented Mar 22, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our contributor guidelines.
  • Tests for the changes have been added (for bug fixes / features)
  • Documentation has been added or updated where needed.

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What issues are resolved by this PR?

Describe the new behavior.

Implements the description outlined in #28 to add Outputs to the GitHub Action in order to enable downstream projects to pull the pipeline number and id.

Example GitHub Job Steps

      - name: Deploying to ${{ inputs.environment_name }} with CircleCI Pipeline
        id: cci_pipeline
        uses:  snapsheet/trigger-circleci-pipeline-action@add_pipeline_request_outputs
        with:
          GHA_Data: ${{ toJSON(inputs) }}
          GHA_Meta: ${{ inputs.environment_name }}
          CCI_Context: ${{ fromJson(steps.environment_config.outputs.json_string).context }}
        env:
          CCI_TOKEN: ${{ secrets.CCI_TOKEN }}
          CCI_HOST: circleci.com # ...now required...?

      - name: Check CircleCI Outputs
        run: |
          echo "id: ${{ steps.cci_pipeline.outputs.id }}"
          echo "state: ${{ steps.cci_pipeline.outputs.state }}"
          echo "created_at: ${{ steps.cci_pipeline.outputs.created_at }}"
          echo "number: ${{ steps.cci_pipeline.outputs.number }}"

You should now see the outputs in your run logs:

Successfully triggered CircleCI Pipeline
Run echo "id: 0f1c3884-fa98-4b9d-a95d-b473dd398cf1"
id: 0f1c3884-fa98-4b9d-a95d-b473dd398cf1
state: pending
created_at: 2023-03-22T19:08:10.214Z
number: 1298

Does this PR introduce a breaking change?

  • Yes
  • No

@whatisdot whatisdot mentioned this pull request Mar 22, 2023
1 task
Copy link
Contributor

@KyleTryon KyleTryon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent addition, thank you for this! We'll have a new release go out either today or no later than end of week.

@KyleTryon KyleTryon merged commit 0e4a095 into CircleCI-Public:main Mar 23, 2023
@whatisdot whatisdot deleted the add_pipeline_request_outputs branch March 23, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants