Skip to content

Commit

Permalink
Merge branch 'main' into all-contributors/add-JTunis
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAugustin authored Aug 24, 2022
2 parents 01ba237 + cfedb72 commit 0659f53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ You will receive a pull request within your repository if there are some changes
| source_repo_path | Repository path of the template | `true` | |
| upstream_branch | The target branch | `true` | `main` |
| source_repo_ssh_private_key | `[optional]` private ssh key for the source repository. E.q. useful if using a private template repository. [see](#private-template-repository)| `false` | |
| 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` | `chore,template_sync` |
| hostname | `[optional]` the hostname of the repository | `false` | `github.com` |

Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ 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_branch_name_prefix:
description: '[optional] the prefix of branches created by this action'
default: 'chore/template_sync'
pr_title:
description: '[optional] the title of PRs opened by this action'
default: 'upstream merge template repository'
pr_labels:
description: '[optional] comma separated list of pull request labels'
default: 'chore,template-sync'
Expand All @@ -31,5 +37,7 @@ runs:
SOURCE_REPO_PATH: ${{ inputs.source_repo_path }}
UPSTREAM_BRANCH: ${{ inputs.upstream_branch }}
SSH_PRIVATE_KEY_SRC: ${{ inputs.source_repo_ssh_private_key }}
PR_BRANCH_NAME_PREFIX: ${{ inputs.pr_branch_name_prefix }}
PR_TITLE: ${{ inputs.pr_title }}
PR_LABELS: ${{ inputs.pr_labels }}
HOSTNAME: ${{ inputs.hostname }}
4 changes: 2 additions & 2 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TEMPLATE_VERSION_FILE_NAME=".templateversionrc"
TEMPLATE_SYNC_IGNORE_FILE_NAME=".templatesyncignore"
TEMPLATE_REMOTE_GIT_HASH=$(git ls-remote "${SOURCE_REPO}" HEAD | awk '{print $1}')
NEW_TEMPLATE_GIT_HASH=$(git rev-parse --short "${TEMPLATE_REMOTE_GIT_HASH}")
NEW_BRANCH="chore/template_sync_${NEW_TEMPLATE_GIT_HASH}"
NEW_BRANCH="${PR_BRANCH_NAME_PREFIX}_${NEW_TEMPLATE_GIT_HASH}"

echo "::group::Check new changes"
echo "::debug::new Git HASH ${NEW_TEMPLATE_GIT_HASH}"
Expand Down Expand Up @@ -85,7 +85,7 @@ echo "::endgroup::"

echo "::group::create pull request"
gh pr create \
--title "upstream merge template repository" \
--title ${PR_TITLE} \
--body "Merge ${SOURCE_REPO_PATH} ${NEW_TEMPLATE_GIT_HASH}" \
-B "${UPSTREAM_BRANCH}" \
-l "${PR_LABELS}"
Expand Down

0 comments on commit 0659f53

Please sign in to comment.