From 964b16174a24d517420640c0e81466c93491c147 Mon Sep 17 00:00:00 2001 From: David Calvert Date: Mon, 17 Jul 2023 23:16:08 +0200 Subject: [PATCH] feat: ability to add reviewers for pull requests (#362) * feat: ability to add reviewers for pull requests Signed-off-by: David Calvert * feat: bump to v1.1.0 Signed-off-by: David Calvert --------- Signed-off-by: David Calvert Signed-off-by: David Calvert --- .github/workflows/actions_template_sync.yml | 2 +- README.md | 9 +++++---- action.yml | 3 +++ src/sync_template.sh | 5 +++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/actions_template_sync.yml b/.github/workflows/actions_template_sync.yml index 8676a9ac..17eb68ec 100644 --- a/.github/workflows/actions_template_sync.yml +++ b/.github/workflows/actions_template_sync.yml @@ -16,7 +16,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: actions-template-sync - uses: AndreasAugustin/actions-template-sync@v1.0.0-draft + uses: AndreasAugustin/actions-template-sync@v1.1.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} source_repo_path: AndreasAugustin/template diff --git a/README.md b/README.md index 0e226d73..0cf3ba66 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: actions-template-sync - uses: AndreasAugustin/actions-template-sync@v1.0.0-draft + uses: AndreasAugustin/actions-template-sync@v1.1.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} source_repo_path: @@ -122,7 +122,7 @@ jobs: with: token: ${{ steps.generate_token.outputs.token }} - name: actions-template-sync - uses: AndreasAugustin/actions-template-sync@v1.0.0-draft + uses: AndreasAugustin/actions-template-sync@v1.1.0 with: github_token: ${{ steps.generate_token.outputs.token }} source_repo_path: @@ -150,7 +150,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: actions-template-sync - uses: AndreasAugustin/actions-template-sync@v1.0.0-draft + uses: AndreasAugustin/actions-template-sync@v1.1.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} source_repo_path: ${{ secrets.SOURCE_REPO_PATH }} # , should be within secrets @@ -204,7 +204,7 @@ jobs: token: ${{ secrets.CUSTOM_GITHUB_PAT }} - name: Test action step PAT - uses: AndreasAugustin/actions-template-sync@v1.0.0-draft + uses: AndreasAugustin/actions-template-sync@v1.1.0 with: github_token: ${{ secrets.CUSTOM_GITHUB_PAT }} source_repo_path: ${{ secrets.SOURCE_REPO_PATH }} # , should be within secrets @@ -221,6 +221,7 @@ jobs: | pr_branch_name_prefix | `[optional]` the prefix of branches created by this action | `false` | `chore/template_sync` | | pr_title | `[optional]` the title of PRs opened by this action. Must be already created. | `false` | `upstream merge template repository` | | pr_labels | `[optional]` comma separated list. [pull request labels][pr-labels]. Must be already created. | `false` | | +| pr_reviewers | `[optional]` comma separated list of pull request reviewers. | `false` | | | pr_commit_msg | `[optional]` commit message in the created pull request | `false` | `chore(template): merge template changes :up:` | | hostname | `[optional]` the hostname of the repository | `false` | `github.com` | | is_dry_run | `[optional]` set to `true` if you do not want to push the changes and not want to create a PR | `false` | | diff --git a/action.yml b/action.yml index 9d7bc96f..a4a23b5d 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,8 @@ inputs: default: "upstream merge template repository" pr_labels: description: "[optional] comma separated list of pull request labels" + pr_reviewers: + description: "[optional] comma separated list of pull request reviewers" pr_commit_msg: description: "[optional] the commit message of the template merge" default: "chore(template): merge template changes :up:" @@ -54,6 +56,7 @@ runs: PR_BRANCH_NAME_PREFIX: ${{ inputs.pr_branch_name_prefix }} PR_TITLE: ${{ inputs.pr_title }} PR_LABELS: ${{ inputs.pr_labels }} + PR_REVIEWERS: ${{ inputs.pr_reviewers }} PR_COMMIT_MSG: ${{ inputs.pr_commit_msg }} HOSTNAME: ${{ inputs.hostname }} IS_DRY_RUN: ${{ inputs.is_dry_run }} diff --git a/src/sync_template.sh b/src/sync_template.sh index 3b159e47..e7a4fb3a 100644 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -125,8 +125,9 @@ push_and_create_pr () { gh pr create \ --title "${PR_TITLE}" \ --body "Merge ${SOURCE_REPO_PATH} ${NEW_TEMPLATE_GIT_HASH}" \ - -B "${UPSTREAM_BRANCH}" \ - -l "${PR_LABELS}" + --base "${UPSTREAM_BRANCH}" \ + --label "${PR_LABELS}" \ + --reviewer "${{ PR_REVIEWERS }}" echo "::endgroup::" else warn "dry_run option is set to off. Skipping push changes and skip create pr"