What does the http request to trigger a deployment event look like?

雨燕双飞 提交于 2020-02-06 08:03:24

问题


I want to fire a deployment event but I don't really understand the http request I need to send in order for it to work. What does minimal request look like? curl -vvv is good, since I'll be doing it with shell.


回答1:


The event you linked is generated when a deployment occurs. So I think what you actually want to do is create a deployment?

To create a deployment during a GitHub actions step with curl it should look something like the following. See the documentation here for details of other parameters you might want to send via the API.

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Create deployment
        run: |
          curl -XPOST 'https://api.github.com/repos/$GITHUB_REPOSITORY/deployments' \
            -H "Content-Type: application/json" \
            -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
            -H "Accept: application/vnd.github.ant-man-preview+json" \
            --data '{ "ref": "master" }'

Alternatively, there are a number of third party actions on the GitHub Marketplace specifically for creating deployments. See here.



来源:https://stackoverflow.com/questions/59972352/what-does-the-http-request-to-trigger-a-deployment-event-look-like

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!