From 814f4564aa1ce6d354dcf48a34ea5b7a670327a5 Mon Sep 17 00:00:00 2001 From: andy Augustin Date: Thu, 28 Mar 2024 22:01:18 +0100 Subject: [PATCH] fix(#510): :bug: issue with blank lines within .templatesyncignore (#512) * fix: :bug: Signed-off-by: Andy Augustin * fix(#510): :bug: .templatesyncignore issue with pathspec git reset Signed-off-by: Andy Augustin * docs: :memo: update some features Signed-off-by: Andy Augustin --------- Signed-off-by: Andy Augustin --- README.md | 16 +++++++++++++--- src/sync_template.sh | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1b8c057..0d61571 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,13 @@ Because of the nice community, several feature requests helped to go on with the ## Features +This action is creating a pull request with the latest changes within the target repo whenever it runs with following exceptions + +* there is already an open PR created with the latest changes of the source repository. + * if there are new changes and a PR is already open, a new PR will be created (option to clean up older PRs) +* related new changes are ignored within the `.templatesyncignore` file +* the source repository is fully included within the target repository + ```mermaid flowchart LR github_source("fa:fa-github GitHub source repository [private|public]") @@ -89,7 +96,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 # https://github.com/actions/checkout#usage - # uncomment if you use submodules within the source repository + # uncomment if you use submodules within the repository # with: # submodules: true @@ -119,14 +126,16 @@ jobs: runs-on: ubuntu-latest steps: - - name: Generate token to read from source repo # see: https://github.com/tibdex/github-app-token + - name: Generate token to read from source repo # see: https://github.com/tibdex/github-app-token id: generate_token - uses: tibdex/github-app-token@v1 + # https://github.com/tibdex/github-app-token + uses: tibdex/github-app-token@v2 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.PRIVATE_KEY }} - name: Checkout + # https://github.com/actions/checkout#usage uses: actions/checkout@v4 with: # submodules: true @@ -163,6 +172,7 @@ jobs: steps: # To use this repository's private action, you must check out the repository - name: Checkout + # https://github.com/actions/checkout#usage uses: actions/checkout@v4 with: # submodules: true diff --git a/src/sync_template.sh b/src/sync_template.sh index df0dfda..b24015e 100755 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -357,8 +357,8 @@ function handle_templatesyncignore() { # we are checking the ignore file if it exists or is empty # -s is true if the file contains whitespaces if [ -s "${template_sync_ignore_file_path}" ]; then - debug "unstage files from template sync ignore" - git reset --pathspec-from-file="${template_sync_ignore_file_path}" + debug "unstage files from template sync ignore ${template_sync_ignore_file_path}" + < "${template_sync_ignore_file_path}" awk NF | xargs -r git reset -- debug "clean untracked files" git clean -df