create-codeberg-pull-request.sh (1126B)
1 #!/bin/bash 2 set -o errexit 3 set -o pipefail 4 set -o nounset 5 6 source envvars 7 8 if [[ "${READABLE_CSS_CHANGED}" != "true" ]]; then 9 echo "Skip pull request." 10 exit 0 11 fi 12 13 # This is actually a Woodpecker CI plugin. 14 # However, Woodpecker pipelines are currently not able to set plugin values 15 # from previous steps. 16 # We need a way to dynamically set the pull request title and body, so we used 17 # env variables instead and build the project ourselves. 18 git clone https://codeberg.org/JohnWalkerx/gitea-pull-request-create-plugin 19 (cd gitea-pull-request-create-plugin; go build) 20 21 export PLUGIN_GITEA_ADDRESS='https://codeberg.org' 22 export PLUGIN_GITEA_TOKEN="${CB_TOKEN}" 23 24 export PLUGIN_OWNER="${CI_REPO_OWNER}" 25 export PLUGIN_REPO="${CI_REPO_NAME}" 26 export PLUGIN_BRANCH="${PULL_REQUEST_BRANCH}" 27 export PLUGIN_BASE_BRANCH='main' 28 29 export PLUGIN_PR_TITLE="Update readable.css to ${READABLE_CSS_TAG}" 30 PLUGIN_PR_BODY=$(cat << EOF 31 See the changelog here: 32 33 https://codeberg.org/Freedom-to-Write/readable.css/src/tag/${READABLE_CSS_TAG}/CHANGELOG.md 34 EOF 35 ) 36 export PLUGIN_PR_BODY 37 38 gitea-pull-request-create-plugin/gitea-pull-request-create-plugin