How to push results from a GitHub action
To setup pushing your results using GitHub actions, you first need to get your CI token on Cucumber for Jira:
Ci configuration
Copy the token
Then you will have to set it as repository secret on your GitHub project. You can call it C4J_TOKEN for example.
When that secret is setup you can start writing your GitHub action.
Here is an example of a GitHub action that generates Cucumber results and sends them to Cucumber for Jira:
name: CI
on:
push:
branches:
- main
jobs:
cucumber:
name: Cucumber test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Run Cucumber tests and generate results
run: |
bundle exec cucumber \
--format json \
--out cucumber-results.json
- name: Send results to Cucumber for Jira
if: always()
run: |
curl -X POST https://c4j.cucumber.io/ci/rest/api/results \
-H "authorization: Bearer ${{ secrets.C4J_TOKEN }}" \
-H 'content-type: multipart/form-data' \
-F results_file=@cucumber-results.json \
-F language=ruby