diff --git a/.github/workflows/che-properties-docs-update.yml b/.github/workflows/che-properties-docs-update.yml new file mode 100644 index 0000000000..dff7674593 --- /dev/null +++ b/.github/workflows/che-properties-docs-update.yml @@ -0,0 +1,48 @@ +# +# Copyright (c) 2021 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +name: build-next + +on: + workflow_dispatch: + push: + branches: + - main + - '7.[0-9]+.[0-9]+' + paths: + - 'assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties' + - 'assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/multiuser.properties' + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Execute workflow in Che Docs + id: build + run: | + invokeAction() { + this_repo=$1 + this_action_name=$2 + this_workflow_id=$3 + this_var=$4 + this_val=$5 + + # can compute using GH API + # workflow_id=$(curl -sSL https://api.github.com/repos/${this_repo}/actions/workflows -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" | jq --arg search_field "${this_action_name}" '.workflows[] | select(.name == $search_field).id'); # echo "workflow_id = $workflow_id" + # or just pass it in + workflow_id=$this_workflow_id + + curl -sSL https://api.github.com/repos/${this_repo}/actions/workflows/${workflow_id}/dispatches -X POST -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" -d "{\"ref\":\"master\",\"inputs\": {\"${this_var}\":\"${this_val}\"} }" + echo "[INFO] Invoked '${this_action_name}' action ($workflow_id) - see https://github.com/${this_repo}/actions?query=workflow%3A%22${this_action_name// /+}%22" + } + + branch=${GITHUB_REF%/} + + # invoke action from che-docs repo + invokeAction eclipse/che-docs "Update Che variables in the docs" "13902929" branch "${branch}"