|
2 | 2 |
|
3 | 3 | This Github actions adds functions for creating a status on the github deployment api. |
4 | 4 |
|
5 | | -It is a small wrapper for your workflows to use the Github Deployment Status API https://developer.github.com/v3/repos/deployments/#create-a-deployment-status |
| 5 | +It is a small wrapper for your workflows to use the Github Deployment Status API https://docs.github.com/en/rest/reference/repos#deployments |
| 6 | + |
| 7 | +Read more on the deployment event on github actions https://docs.github.com/en/actions/reference/events-that-trigger-workflows#deployment |
6 | 8 |
|
7 | 9 | ## Usage |
8 | 10 |
|
9 | | -For example use this at the end of your job like this: |
| 11 | +For example like this |
| 12 | +``` |
| 13 | +on: deployment |
| 14 | +name: Deploy |
| 15 | +jobs: |
| 16 | + deploy: |
| 17 | + name: Deploy event |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Set deploystatus in_progress |
| 21 | + uses: unacast/actions-github-deployment-status@[version] |
| 22 | + with: |
| 23 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + status: in_progress |
| 25 | +
|
| 26 | +... <Do your deploy stuff> |
| 27 | + - name: Set an environment |
| 28 | + run: | |
| 29 | + echo '::set-env name=DEPLOY_ENVIRONMENT::http://halloi.lol' |
10 | 30 |
|
| 31 | + - name: Update result to Deployment API |
| 32 | + if: always() |
| 33 | + uses: unacast/actions-github-deployment-status@[version] |
| 34 | + with: |
| 35 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + status: ${{ job.status }} |
| 37 | + description: "Deployed to some magic" |
| 38 | + environment_url: '${{ DEPLOY_ENVIRONMENT }}' |
11 | 39 | ``` |
12 | | -- name: update deploy status |
13 | | - if: always() |
14 | | - uses: unacast/actions-github-deployment-status@[version] |
15 | | - with: |
16 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
17 | | - status: ${{ job.status }} |
18 | | - description: "The description to create. Restricted to 140 chars" |
| 40 | + |
| 41 | +### Inputs |
| 42 | +The action has the following inputs (see in action.yml) |
19 | 43 | ``` |
| 44 | + github_token: |
| 45 | + description: 'The GITHUB_TOKEN secret' |
| 46 | + required: true |
| 47 | + status: |
| 48 | + description: 'The status to create. Can be one of error, failure, inactive, in_progress, queued, pending, or success' |
| 49 | + required: true |
| 50 | + description: |
| 51 | + description: 'The description to create. Restricted to 140 chars' |
| 52 | + required: false |
| 53 | + default: "" |
| 54 | + environment_url: |
| 55 | + description: 'Sets the URL for accessing your environment' |
| 56 | + required: false |
| 57 | + default: "" |
| 58 | + auto_inactive: |
| 59 | + description: "Adds a new inactive status to all prior non-transient, non-production environment deployments with the same repository and environment name as the created status's deployment. An inactive status is only added to deployments that had a success state." |
| 60 | + required: false |
| 61 | + default: true |
| 62 | +``` |
| 63 | + |
| 64 | +## FAQ |
| 65 | +Q: Can I use this in workflows that listens to events other than the deployment event? |
| 66 | +A: No. This is tailored to the deployment event. |
0 commit comments