~sircmpwn/dispatch.sr.ht

79b474a6375660dc34c9b0c5fd8668430c1e0fa7 — Paul Spooren a month ago 562cf2d 0.14.5
github: Add GITHUB_PR_BODY env variable

The body of a GitHub PR commit message is provided via the API v3 called
`body`[0]. This body can may contain information to incluence the CI
build.

An example, OpenWrt supports 80 different hardware architectures,
building all of them takes about 80 hours. Changing something for target
x86/64 should only trigger that specific target to be build. A PR commit
message could now contain a line like `CI: build x86/64` which is read
by the CI via a command like the following:

TARGET=$(echo $GITHUB_PR_BODY | grep "CI: build" | cut -d ' ' -f 3)"

[0]: https://developer.github.com/v3/pulls/

Signed-off-by: Paul Spooren <mail@aparcar.org>
1 files changed, 1 insertions(+), 0 deletions(-)

M dispatchsrht/tasks/github/github_pr_to_build.py
M dispatchsrht/tasks/github/github_pr_to_build.py => dispatchsrht/tasks/github/github_pr_to_build.py +1 -0
@@ 130,6 130,7 @@ class GitHubPRToBuild(TaskDef):
                    "GITHUB_EVENT": request.headers.get("X-GitHub-Event"),
                    "GITHUB_PR_NUMBER": str(pr["number"]),
                    "GITHUB_PR_TITLE": pr["title"],
                    "GITHUB_PR_BODY": pr["body"],
                    "GITHUB_BASE_REPO": base_repo["full_name"],
                    "GITHUB_HEAD_REPO": head_repo["full_name"],
                })