I want to trigger the GitHub Actions using Jenkins Pipeline or Jenkins Job and send some build parameters as input for the GitHub Actions. I am doing this since there is no option of dropdown list for the GitHub Action Input parameters.
-
Hi! Did you solve this problem? – ov7a Mar 23 '22 at 13:01
2 Answers
This is only half a solution. But there is an option to specify an input params list for GitHub actions.
See workflow_dispatch
event type on GitHub actions. The current url is here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch (If this stops working just google workflow_dispatch)
The other half (Jenkins triggering a GHA build), I am actually searching for myself too! I can find ones working in reverse. GHA triggering jenkins.

- 460
- 2
- 10
We can trigger Github action with rest api (POST) or curl requests. All you need to do create with workflow with dispatch trigger (repository_dispatch or workflow_dispatch)
on:
workflow_dispatch:
inputs:
InputKey:
type: string
required: true
next trigger this workflow by one of the below methods
1. POST https://api.github.com/repos///dispatches Authorization: Bearer
{"event_type": "hello"}
- curl --request POST
--url 'https://api.github.com/repos///dispatches'
--header 'authorization: Bearer '
--data '{"event_type": "hello"}'
Also specify the inputs in requests with --data '{"event_type": "<workflow name>","client_payload":{"<input_key>":"<input_value>"}}'
All you need to do now is put this request in your job (scripted pipeline is preferred) with appropriate values.

- 51
- 1
- 1
- 3