diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d6f40ee8..f2ac19098 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ on: type: string default: "dev" push: - branches: [ "dev" ] + branches: [ "447-publish-consolidated-cucumber-report-gh-actions" ] schedule: - cron: "0 6 * * *" # every day at 6am UTC @@ -117,3 +117,23 @@ jobs: with: path: ~/.m2/build-cache key: maven-build-cache-${{ hashFiles('**/pom.xml') }} + # Generate & Publish Cucumber report + - name: Install Cucumber HTML Reporter + run: npm install multiple-cucumber-html-reporter + - name: Aggregate Cucumber JSON files + run: | + mkdir -p cucumber-reports + cp **/cucumber.json cucumber_reports/ + npx multiple-cucumber-html-reporter --jsonDir=cucumber_reports --reportPath=./cucumber_report + - name: Publish Cucumber Report + env: + CUCUMBER_PUBLISH_TOKEN: "b9aed90d-fac1-4b6c-bc07-83d0df2d8bbf" + run: | + # Publish each JSON file to Cucumber Reports + for report in cucumber_reports/*.json; do + cat "$report" | curl -X POST \ + -H "Content-Type: Application/json" \ + -H "Authorization: Bearer b9aed90d-fac1-4b6c-bc07-83d0df2d8bbf \ + -d @- \ + https://reports.cucumber.io/api/reports + done