Skip to content

Latest commit

 

History

History
66 lines (55 loc) · 2.74 KB

publish-test-results.md

File metadata and controls

66 lines (55 loc) · 2.74 KB

publish-test-results.yml

This workflow will publish the test results from the artifact_<operating-system-name>_tests artifacts uploaded by the test-code.yml workflow by creating a comment on the Pull Request that triggered the test run. The reason this is a separate workflow that is triggered by the workflow_run event is to allow Pull Requests from forks to still have test results published as comments. Due to the reduced permissions of workflows that are run against Pull Requests from forks, this workflow must be a separate workflow so that it has the elevated permissions necessary to create a comment on the Pull Request.

The workflow calling this reusable workflow must be set to trigger on a completed workflow_run event of the workflow that tests the code, usually a Workflow named Test code, see the example below for the correct yaml syntax.

Important

When calling this reusable workflow, the permissions must be set as follows:

permissions:
  checks: write
  pull-requests: write

Note

This workflow uses the following GitHub Actions:

See the Workflow file for the currently used versions of each GitHub Action.

Tip

See the Workflow file for implementation details.

Inputs

Important

The operating-systems-array input variable must match the operating-systems-array input variable that is used as an input to the test-code.yml workflow so that test results are published for each operating system that ran tests.

Input variable Necessity Description Default
operating-systems-array optional A valid JSON array of operating system names to publish test results for. '["ubuntu", "windows", "macos"]'

Example

name: Publish Test Results
on:
  workflow_run:
    workflows: [Test code]
    types: [completed]
jobs:
  publish-test-results:
    uses: tektronix/python-package-ci-cd/.github/workflows/_reusable-publish-test-results.yml@v0.0.1
    with:
        operating-systems-array: '["ubuntu", "windows", "macos"]'  # required
    permissions:
      checks: write
      pull-requests: write