From 55484dc36dd0cc1313d4d946194463955a2f4be1 Mon Sep 17 00:00:00 2001 From: Andy Augustin Date: Thu, 16 Dec 2021 10:02:39 +0100 Subject: [PATCH] feat(action): add parameter for gh action configuration (#129) :rocket: --- action.yml | 4 ++++ src/sync_template.sh | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 790777c4..350ad927 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,9 @@ inputs: default: 'main' source_repo_ssh_private_key: description: '[optional] private ssh key for the source repository. E.q. useful if using a private template repository.' + pr_labels: + description: '[optional] comma separated list of pull request labels' + default: 'chore,template-sync' runs: using: 'docker' image: 'src/Dockerfile' @@ -25,3 +28,4 @@ runs: SOURCE_REPO_PATH: ${{ inputs.source_repo_path }} UPSTREAM_BRANCH: ${{ inputs.upstream_branch }} SSH_PRIVATE_KEY_SRC: ${{ inputs.source_repo_ssh_private_key}} + PR_LABELS: ${{inputs.pr_labels}} diff --git a/src/sync_template.sh b/src/sync_template.sh index 2638dc4c..463bc24f 100755 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -13,6 +13,11 @@ if [[ -z "${UPSTREAM_BRANCH}" ]]; then exit 1; fi +if [[ -z "${PR_LABELS}" ]]; then + echo "::error::Missing env variable 'PR_LABELS'" >&2; + exit 1; +fi + if ! [ -x "$(command -v gh)" ]; then echo "::error::github-cli gh is not installed. 'https://github.com/cli/cli'" >&2; exit 1; @@ -82,5 +87,6 @@ echo "::group::create pull request" gh pr create \ --title "upstream merge template repository" \ --body "Merge ${SOURCE_REPO_PATH} ${NEW_TEMPLATE_GIT_HASH}" \ - -B "${UPSTREAM_BRANCH}" + -B "${UPSTREAM_BRANCH}" \ + -l "${PR_LABELS}" echo "::endgroup::"