问题
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