Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Ground Controller Lvl 2
Message 11 of 66

Re: GitHub Actions Manual Trigger / Approvals

We are considering migration to GitHub Actions but without this functionality it might not be possible :(

 

Br.

Highlighted
Pilot Lvl 1
Message 12 of 66

Re: GitHub Actions Manual Trigger / Approvals

Highlighted
Copilot Lvl 3
Message 13 of 66

Re: GitHub Actions Manual Trigger / Approvals

It's very limited right now. It's impossible to pass any custom parameters, and the workflow YAML file must sit on master.

Highlighted
Ground Controller Lvl 1
Message 14 of 66

Re: GitHub Actions Manual Trigger / Approvals

I'm surprised this wasn't included with the initial offering. I imagine a lot of people will want to follow the same track in using Actions for deployment. I'm trying to figure out a nicer alternative for the time being, but this would be a useful and much needed addition.

Highlighted
Ground Controller Lvl 1
Message 15 of 66

Re: GitHub Actions Manual Trigger / Approvals

I was really surprised when I found out there was no way to trigger an action manually from the repo.

Coming from GitLab's CI, this is an important feature for us. We find it cumbersome to use an API to trigger our deployments.

 

I hope this feature is gonna make it in the initial release of GitHub actions.

Highlighted
Pilot Lvl 2
Message 16 of 66

Re: GitHub Actions Manual Trigger / Approvals

There should be a button for this in the interface, yes. In the meantime you should be able to trigger a build manually by sending a Repository Dispatch Event to the GitHub API. If you use something like PostMan you can save a request that does that, or simply create a small curl script that you can run from your machine.

 

You can then attach your workflow to the `repository_dispatch` event to have it triggered when you POST to the API:

 

on: repository_dispatch

jobs:
  manual_deploy:
    steps:
      - name: Checkout master
        uses: actions/checkout@v1
        with:
          ref: master
      - <and so on>

It's not ideal, but it should allow you to trigger manual builds until official support is added to the UI.

Highlighted
Pilot Lvl 1
Message 17 of 66

Re: GitHub Actions Manual Trigger / Approvals

Deployment as been mentioned above.

If you are doing a deployment, do not use repository_dispatch. GitHub has first class support for deployment workflows:

https://developer.github.com/v3/repos/deployments/

Trigger a deployment via the API (we have internal tooling to ease this)

 

curl POST -H "Authorization: token $GITHUB_TOKEN" \
          -H "Accept: application/vnd.github.ant-man-preview+json"  \
          -H "Content-Type: application/json" \
          https://api.github.com/repos/org/repo/deployments \
          --data '{"ref": "master", "environment": "production"}'

 

Then have a workflow to do your deployment:

 

name: 'Deploy'
on: ['deployment']

jobs:
  deployment:

    runs-on: 'ubuntu-latest'

    steps:
    - name: 'Checkout'
      uses: 'actions/checkout@v1'

    - name: 'Deployment pending'
      uses: 'deliverybot/status@master'
      with:
        state: 'pending'
        token: '${{ secrets.GITHUB_TOKEN }}'

# do your deployment here, using whatever tooling you like:
- name: 'Deploy ${{ github.event.deployment.environment }}' run: | echo "task - ${{ github.event.deployment.task }}" echo "environment - ${{ github.event.deployment.environment }}" echo "payload - ${{ toJson(github.event.deployment.payload) }}" - name: 'deployment success' if: success() uses: 'deliverybot/status@master' with: state: 'success' token: '${{ secrets.GITHUB_TOKEN }}' - name: 'deployment failure' if: failure() uses: 'deliverybot/status@master' with: state: 'failure' token: '${{ secrets.GITHUB_TOKEN }}' 

 

Highlighted
Ground Controller Lvl 1
Message 18 of 66

Re: GitHub Actions Manual Trigger / Approvals

Minor: The curl command looks like this. You need to pass an empty array to required_contexts or create a status for a commit sha. 

 

curl \
-X POST \
-H "Authorization: token $GIT_PERSONAL_ACCESS_TOKEN" \
-H "Accept: application/vnd.github.ant-man-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/bqh-kaiserhl/all/deployments \
--data '{"ref": "master", "required_contexts": [], "environment": "production"}'

 

Highlighted
Copilot Lvl 3
Message 19 of 66

Re: GitHub Actions Manual Trigger / Approvals

As mentioned in https://github.community/t5/GitHub-Actions/repository-dispatch-not-triggering-actions/m-p/33845/high..., `repository_dispatch` will only trigger on default (master) branch.

Highlighted
Copilot Lvl 3
Message 20 of 66

Re: GitHub Actions Manual Trigger / Approvals

As someone trying to move from Azure DevOps Pipelines to GitHub actions, having no manual triggers/approvers is a step back 🙁 Hope to see this feature added very soon.