1
0
mirror of https://codeberg.org/gitnex/GitNex synced 2024-12-23 00:48:57 +01:00
GitNex-Android-App/scripts/add-commit-status.sh
qwerty287 24c7176753 Link to pipeline instead of overview (#1038)
See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html. Links to the exact pipeline instead of the pipeline overview.

Co-authored-by: qwerty287 <ndev@web.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1038
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-02-19 09:50:15 +01:00

30 lines
709 B
Bash
Executable File

#!/bin/sh
# Environment variables which have to be set in order for this to work properly
# @author opyale
#
# INSTANCE (e.g. https://codeberg.org)
# MAIN_REPO (e.g. gitnex/GitNex)
# STATE (e.g. pending, success, error, failure or warning)
# CI_COMMIT_SHA; BOT_TOKEN
context="GitLab CI"
description="GitLab continuous integration tool"
state=$STATE
target_url=$CI_PIPELINE_URL
body='
{
"context": "'$context'",
"description": "'$description'",
"state": "'$state'",
"target_url": "'$target_url'"
}
'
curl --request POST \
--data "$body" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
"${INSTANCE}/api/v1/repos/${MAIN_REPO}/statuses/${CI_COMMIT_SHA}?token=${BOT_TOKEN}"