Skip to content

Commit 702c1ef

Browse files
committed
Document how to schedule tests via @openqa: in a GHA
And mention that comments require API access. See: https://progress.opensuse.org/issues/191635
1 parent 6bd1da8 commit 702c1ef

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

docs/WritingTests.asciidoc

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,11 +2330,31 @@ feature is explained in further detail in the corresponding
23302330
<<UsersGuide.asciidoc#scenarios_yaml,users guide section>>.
23312331

23322332
It is also possible to create a GitHub workflow that will clone and monitor an
2333-
openQA job which is mentioned in the PR description or comment. The scripts
2334-
repository contains a pre-defined GitHub action for this. Checkout the
2335-
documentation of the
2336-
https://github.com/os-autoinst/os-autoinst-scripts/blob/master/openqa-clone-and-monitor-job-from-pr[openqa-clone-and-monitor-job-from-pr]
2337-
script for further information and an example configuration.
2333+
openQA job which is mentioned in the PR description using https://github.com/os-autoinst/os-autoinst-scripts/blob/master/openqa-clone-and-monitor-job-from-pr[openqa-clone-and-monitor-job-from-pr] with something like this:
2334+
2335+
----
2336+
name: Schedule openQA tests mentioned via @openqa:
2337+
on:
2338+
pull_request_target:
2339+
workflow_dispatch:
2340+
env:
2341+
OPENQA_HOST: ${{ secrets.OPENQA_URL }}
2342+
OPENQA_API_KEY: ${{ secrets.OPENQA_API_KEY }}
2343+
OPENQA_API_SECRET: ${{ secrets.OPENQA_API_SECRET }}
2344+
GH_REPO: ${{ github.event.pull_request.head.repo.full_name }}
2345+
GH_REF: ${{ github.event.pull_request.head.ref }}
2346+
GH_PR_BODY: ${{ github.event.pull_request.body }}
2347+
jobs:
2348+
clone_and_monitor_job_from_pr:
2349+
runs-on: ubuntu-latest
2350+
container:
2351+
image: registry.opensuse.org/devel/openqa/containers/tumbleweed:client
2352+
steps:
2353+
- uses: os-autoinst/os-autoinst-scripts/actions/clone-job@master
2354+
----
2355+
2356+
In this example the body of the PR is passed via `GH_PR_BODY`. Comments can also
2357+
be provided but this requires use of the GitHub API via the comments endpoint.
23382358

23392359
NOTE: These examples show how API credentials are supplied. It is important to
23402360
note that using `on:pull_request` would only work for PRs created on the main
@@ -2343,14 +2363,6 @@ repository but not for PRs created from forks. Therefore
23432363
version the variables under `github.event.pull_request.head.*` are utilized
23442364
(instead of e.g. just `$GITHUB_REF`).
23452365

2346-
NOTE: Due to the use of `on:pull_request_target` the scenario definitions are
2347-
read from the main repository in this example. This is the conservative
2348-
approach. To allow scheduling jobs based on the PR version of the scenario
2349-
definitions file one could use e.g.
2350-
`SCENARIO_DEFINITIONS_YAML_FILE=https://raw.githubusercontent.com/$GH_REPO/$GH_REF/.github/workflows/openqa.yml`
2351-
instead of `- uses: actions/checkout@v3` and
2352-
`--param-file SCENARIO_DEFINITIONS_YAML=scenario-definitions.yaml`.
2353-
23542366
=== Use webhooks and status reporting APIs of GitHub
23552367
This approach is so far specific to GitHub and is a bit more effort to setup
23562368
than the approach mentioned in the previous section. For this to work, GitHub

0 commit comments

Comments
 (0)