Skip to content

Support gh deployment create #921

Closed
Closed

Description

@zhigang1992

Describe the feature or problem you’d like to solve

be able to create deployment from CLI

Proposed solution

Currently we have to manually use curl to call API to trigger a deployment

Activity

  1. added
    enhancement
    on May 14, 2020
  2. StefMa commented on May 14, 2020

    @StefMa
  3. zhigang1992 commented on May 15, 2020

    @zhigang1992
    Author
    curl -X POST -H "Authorization: token ***" \                                                      
              -H "Accept: application/vnd.github.ant-man-preview+json"  \
              -H "Content-Type: application/json" \
              https://api.github.com/repos/orgs/repo/deployments \
              --data '{"ref": "master", "environment": "dev", "task":"ios", "required_contexts": []}'
  4. zhigang1992 commented on May 15, 2020

    @zhigang1992
    Author

    Our github action is setup to trigger on: [deployment] and we usually use slack integration to do

    /github deploy orgs/repo

    But something we need to pass extra params like required_contexts, which doesn't work on slack, then we need to fallback to curl.

    It'd be really nice if we can do that with cli. 😄

    @StefMa

  5. mislav commented on May 15, 2020

    @mislav
    Contributor

    Hi @zhigang1992, is this something that you think the upcoming gh api command would be a good fit for? #909

    Your curl command would become roughly:

    gh api repos/orgs/repo/deployments \
      -H "Accept: application/vnd.github.ant-man-preview+json" \
      -f ref=master -f environment=dev ...
    

    But this would still be somewhat manual, since we didn't plan to add any specialized command to manage deployments anytime soon.

  6. changed the title [-]Support `gh deploy create`[/-] [+]Support `gh deployment create`[/+] on May 15, 2020
  7. zhigang1992 commented on May 15, 2020

    @zhigang1992
    Author

    It's better than having to manually managing the tokens. 😄

    If'd be even greater if we can somehow create alias?

  8. mislav commented on May 15, 2020

    @mislav
    Contributor

    @zhigang1992 😉 #294 coming up soon on our roadmap!

  9. vilmibm commented on May 19, 2020

    @vilmibm
    Contributor

    It sounds like we can close this as it's a usecase covered by the upcoming alias+api support <3

    Please correct me if I'm wrong.

  10. zhigang1992 commented on Jul 7, 2020

    @zhigang1992
    Author

    sry to bother you guys again, 😭

    how can I pass "required_contexts": []

    with -f or --raw-field

    it won't accept '[]' or \[\]

  11. mislav commented on Jul 7, 2020

    @mislav
    Contributor

    @zhigang1992 Sorry, neither --field nor --raw-field accept JSON arrays right now. To pass a JSON array or a nested object, you will need to construct the JSON payload outside of gh and pass it in via --input. E.g.

    jq -n '...' | gh api repos/orgs/repo/deployments --input -

    We are open to potentially accepting JSON arrays in a future release, but I can't yet imagine what a possible syntax for that could be!

  12. shouze commented on Aug 25, 2020

    @shouze

    Don't know if it can help but I've created https://github.com/inextensodigital/github some time ago, dedicated to deployments manipulations.

  13. patrickjahns commented on Jan 27, 2021

    @patrickjahns

    Why is this closed - I believe it is still a valid feature request to operate with the github deployments api - which is cumbersome right now

  14. staabm commented on Apr 19, 2021

    @staabm

    we would also love managing deployments via the gh-cli

  15. sbrudz-orum commented on Jul 27, 2023

    @sbrudz-orum

    how can I pass "required_contexts": []

    For anyone else struggling with this, the cli now supports it, but the syntax is: -f required_contexts\[\]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions