Skip to content

Commit

Permalink
feat: ability to add reviewers for pull requests (#362)
Browse files Browse the repository at this point in the history
* feat: ability to add reviewers for pull requests

Signed-off-by: David Calvert <david.calvert@oqton.com>

* feat: bump to v1.1.0

Signed-off-by: David Calvert <david@0xdc.me>

---------

Signed-off-by: David Calvert <david.calvert@oqton.com>
Signed-off-by: David Calvert <david@0xdc.me>
  • Loading branch information
dotdc committed Jul 17, 2023
1 parent 1606b3d commit 964b161
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions_template_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <owner/repo>
Expand Down Expand Up @@ -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: <owner/repo>
Expand Down Expand Up @@ -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 }} # <owner/repo>, should be within secrets
Expand Down Expand Up @@ -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 }} # <owner/repo>, should be within secrets
Expand All @@ -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` | |
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down Expand 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 }}
Expand Down
5 changes: 3 additions & 2 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 964b161

Please sign in to comment.