From 59275109d719809279492fa42a8601b199db8a4f Mon Sep 17 00:00:00 2001 From: mmontes11 Date: Tue, 16 Jul 2024 18:01:21 +0200 Subject: [PATCH] Added dry-run mode --- action.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index d61734c..41c2137 100644 --- a/action.yml +++ b/action.yml @@ -30,6 +30,10 @@ inputs: description: "User email to use in the commit." required: false default: "$GITHUB_ACTOR@users.noreply.github.com" + dry-run: + description: "Enable dry run mode." + required: false + default: "false" runs: using: 'composite' steps: @@ -82,6 +86,8 @@ runs: git add . git commit -m "operator ${{ inputs.name }}(${{ inputs.version }})" --signoff git push -f - gh pr create --repo "${{ inputs.upstream-repo-name }}" \ - --title "operator ${{ inputs.name }} (${{ inputs.version }})" \ - --body "Added operator ${{ inputs.name }} (${{ inputs.version }})" \ No newline at end of file + PR_CMD="gh pr create --repo '${{ inputs.upstream-repo-name }}' --title 'operator ${{ inputs.name }} (${{ inputs.version }})' --body 'Added operator ${{ inputs.name }} (${{ inputs.version }})'" + if [ "${{ inputs.dry-run }}" == "true" ]; then + PR_CMD="$PR_CMD --dry-run" + fi + eval "$PR_CMD" \ No newline at end of file