From ae8065ff4928658652f478e704a07a55196a3c2a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 13 Jul 2026 14:56:28 +0000 Subject: [PATCH 1/4] style: enforce spaces-only indentation (closes #54) build.sh mixed tab- and space-indented blocks (the updpkgsums, test and post_process blocks were tab-indented; one line inside the post_process block even mixed a tab and spaces). Standardize on spaces-only, 2-space indentation and add tooling so it stays consistent going forward: - .editorconfig: declares indent_style=space and indent_size=2 (plus lf line endings, utf-8, final newline and trailing-whitespace trimming) for every editor and file type. - .github/workflows/lint.yml: runs `shfmt -d .` on push and pull_request. shfmt reads the indentation settings from .editorconfig, so any shell script that is not formatted accordingly fails CI. - Reformat build.sh and entrypoint.sh to that canonical style: tabs become 2 spaces, and two "space after redirect" outliers are normalized to the no-space form already used by every other redirect in the scripts. No behavioural change to the scripts. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01F6dDAK5KXrso5SxGiwFFEk --- .editorconfig | 15 +++++++++++++++ .github/workflows/lint.yml | 34 ++++++++++++++++++++++++++++++++++ build.sh | 24 ++++++++++++------------ entrypoint.sh | 2 +- 4 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/lint.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9cc514f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig helps maintain consistent coding styles across editors. +# https://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true + +# Markdown uses trailing whitespace for hard line breaks. +[*.md] +trim_trailing_whitespace = false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..01569ef --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,34 @@ +name: Lint + +on: + push: + branches: [master] + pull_request: + +permissions: + contents: read + +jobs: + shfmt: + name: shell formatting (shfmt) + runs-on: ubuntu-latest + env: + # Keep in sync with any local tooling. Dependabot does not bump this, so + # bump it manually when upgrading shfmt. + SHFMT_VERSION: v3.10.0 + steps: + - uses: actions/checkout@v4 + + - name: Install shfmt + run: | + curl -fsSL \ + "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/shfmt_${SHFMT_VERSION}_linux_amd64" \ + -o /usr/local/bin/shfmt + chmod +x /usr/local/bin/shfmt + shfmt --version + + # shfmt reads indent_style/indent_size from .editorconfig, so this + # enforces the spaces-only, 2-space indentation. It exits non-zero (and + # prints a diff) if any shell script is not formatted accordingly. + - name: Check formatting + run: shfmt -d . diff --git a/build.sh b/build.sh index 45419f0..3a9cca4 100755 --- a/build.sh +++ b/build.sh @@ -9,7 +9,7 @@ assets=$INPUT_ASSETS asset_dir=$INPUT_ASSET_DIR updpkgsums=$INPUT_UPDPKGSUMS test=$INPUT_TEST -read -r -a test_flags <<< "$INPUT_TEST_FLAGS" +read -r -a test_flags <<<"$INPUT_TEST_FLAGS" post_process=$INPUT_POST_PROCESS commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL @@ -114,17 +114,17 @@ fi echo '::endgroup::' if [ "$updpkgsums" == "true" ]; then - echo '::group::Updating checksums' - cd /tmp/local-repo/ - updpkgsums - echo '::endgroup::' + echo '::group::Updating checksums' + cd /tmp/local-repo/ + updpkgsums + echo '::endgroup::' fi if [ "$test" == "true" ]; then - echo '::group::Building package with makepkg' - cd /tmp/local-repo/ - makepkg "${test_flags[@]}" - echo '::endgroup::' + echo '::group::Building package with makepkg' + cd /tmp/local-repo/ + makepkg "${test_flags[@]}" + echo '::endgroup::' fi echo '::group::Generating .SRCINFO' @@ -133,10 +133,10 @@ makepkg --printsrcinfo >.SRCINFO echo '::endgroup::' if [ -n "$post_process" ]; then - echo '::group::Executing post process commands' - cd /tmp/local-repo/ + echo '::group::Executing post process commands' + cd /tmp/local-repo/ eval "$post_process" - echo '::endgroup::' + echo '::endgroup::' fi echo '::group::Committing files to the repository' diff --git a/entrypoint.sh b/entrypoint.sh index 28bc51d..ce39172 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,7 +6,7 @@ echo '::group::Creating builder user' useradd --create-home --shell /bin/bash builder passwd --delete builder mkdir -p /etc/sudoers.d/ -echo "builder ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/builder +echo "builder ALL=(root) NOPASSWD:ALL" >/etc/sudoers.d/builder echo '::endgroup::' echo '::group::Initializing SSH directory' From 5ca44b5d99320a606c1aef81628d1ed9b5489d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=E1=BA=A3i?= Date: Mon, 13 Jul 2026 22:24:03 +0700 Subject: [PATCH 2/4] docs: remove unnecessary comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Khải --- .editorconfig | 2 -- .github/workflows/lint.yml | 5 ----- 2 files changed, 7 deletions(-) diff --git a/.editorconfig b/.editorconfig index 9cc514f..1819fc0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,3 @@ -# EditorConfig helps maintain consistent coding styles across editors. -# https://editorconfig.org root = true [*] diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 01569ef..871f27b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,8 +13,6 @@ jobs: name: shell formatting (shfmt) runs-on: ubuntu-latest env: - # Keep in sync with any local tooling. Dependabot does not bump this, so - # bump it manually when upgrading shfmt. SHFMT_VERSION: v3.10.0 steps: - uses: actions/checkout@v4 @@ -27,8 +25,5 @@ jobs: chmod +x /usr/local/bin/shfmt shfmt --version - # shfmt reads indent_style/indent_size from .editorconfig, so this - # enforces the spaces-only, 2-space indentation. It exits non-zero (and - # prints a diff) if any shell script is not formatted accordingly. - name: Check formatting run: shfmt -d . From 80716fb381d5f07c4d065c121c69d0ba2c20d136 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 13 Jul 2026 18:48:27 +0000 Subject: [PATCH 3/4] style: use 4-space indentation for shell scripts Addresses review feedback on #55: - .editorconfig: set indent_size = 4 for shell/bash files (*.sh, *.bash). Other file types keep the 2-space default (YAML action/workflow files, etc.). - Drop trim_trailing_whitespace and the [*.md] exception it required. It is an editor-only hint (nothing in CI enforces it) that no file in the repo relies on, so removing it keeps .editorconfig focused on indentation. - Reformat build.sh to 4-space indentation accordingly (via shfmt, which reads the per-file indent_size from .editorconfig). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01F6dDAK5KXrso5SxGiwFFEk --- .editorconfig | 6 +- build.sh | 174 +++++++++++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 91 deletions(-) diff --git a/.editorconfig b/.editorconfig index 1819fc0..14ce959 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,8 +6,6 @@ indent_size = 2 end_of_line = lf charset = utf-8 insert_final_newline = true -trim_trailing_whitespace = true -# Markdown uses trailing whitespace for hard line breaks. -[*.md] -trim_trailing_whitespace = false +[*.{sh,bash}] +indent_size = 4 diff --git a/build.sh b/build.sh index 3a9cca4..256bc17 100755 --- a/build.sh +++ b/build.sh @@ -20,39 +20,39 @@ force_push=$INPUT_FORCE_PUSH ssh_keyscan_types=$INPUT_SSH_KEYSCAN_TYPES assert_non_empty() { - name=$1 - value=$2 - if [[ -z "$value" ]]; then - echo "::error::Invalid Value: $name is empty." >&2 - exit 1 - fi + name=$1 + value=$2 + if [[ -z "$value" ]]; then + echo "::error::Invalid Value: $name is empty." >&2 + exit 1 + fi } assert_non_empty inputs.pkgname "$pkgname" if [[ -n "$asset_dir" ]]; then - # asset_dir is the full source of truth for the repository, so it is - # mutually exclusive with both pkgbuild and assets. - if [[ -n "$pkgbuild" ]]; then - echo "::error::Invalid Value: inputs.asset_dir and inputs.pkgbuild are mutually exclusive." >&2 - exit 1 - fi - if [[ -n "$assets" ]]; then - echo "::error::Invalid Value: inputs.asset_dir and inputs.assets are mutually exclusive." >&2 - exit 1 - fi - if [[ ! -d "$asset_dir" ]]; then - echo "::error::Invalid Value: inputs.asset_dir ('$asset_dir') is not a directory." >&2 - exit 1 - fi - if [[ ! -f "$asset_dir/PKGBUILD" ]]; then - echo "::error::Invalid Value: inputs.asset_dir ('$asset_dir') does not contain a PKGBUILD." >&2 - exit 1 - fi - # Resolve to an absolute path now, while we are still in the workspace, so the - # later `cd /tmp/local-repo` does not change how a relative asset_dir resolves. - asset_dir=$(realpath "$asset_dir") + # asset_dir is the full source of truth for the repository, so it is + # mutually exclusive with both pkgbuild and assets. + if [[ -n "$pkgbuild" ]]; then + echo "::error::Invalid Value: inputs.asset_dir and inputs.pkgbuild are mutually exclusive." >&2 + exit 1 + fi + if [[ -n "$assets" ]]; then + echo "::error::Invalid Value: inputs.asset_dir and inputs.assets are mutually exclusive." >&2 + exit 1 + fi + if [[ ! -d "$asset_dir" ]]; then + echo "::error::Invalid Value: inputs.asset_dir ('$asset_dir') is not a directory." >&2 + exit 1 + fi + if [[ ! -f "$asset_dir/PKGBUILD" ]]; then + echo "::error::Invalid Value: inputs.asset_dir ('$asset_dir') does not contain a PKGBUILD." >&2 + exit 1 + fi + # Resolve to an absolute path now, while we are still in the workspace, so the + # later `cd /tmp/local-repo` does not change how a relative asset_dir resolves. + asset_dir=$(realpath "$asset_dir") else - assert_non_empty inputs.pkgbuild "$pkgbuild" + assert_non_empty inputs.pkgbuild "$pkgbuild" fi assert_non_empty inputs.commit_username "$commit_username" assert_non_empty inputs.commit_email "$commit_email" @@ -88,43 +88,43 @@ echo '::endgroup::' echo '::group::Copying files into /tmp/local-repo' if [[ -n "$asset_dir" ]]; then - cd /tmp/local-repo - # Mirror $asset_dir into the repo: first delete everything currently tracked - # (so files removed from $asset_dir are also removed from the AUR repo), then - # copy $asset_dir's contents back in. The .git directory is left untouched. - if git rev-parse --verify --quiet HEAD >/dev/null; then - echo 'Deleting tracked files' - git ls-tree -r --name-only -z HEAD | xargs -0 -r rm -fv - fi - echo "Mirroring $asset_dir into /tmp/local-repo" - # --filter=':- .gitignore' makes rsync honour any .gitignore files in $asset_dir. - rsync -av --filter=':- .gitignore' --exclude=.git "${asset_dir%/}/" /tmp/local-repo/ + cd /tmp/local-repo + # Mirror $asset_dir into the repo: first delete everything currently tracked + # (so files removed from $asset_dir are also removed from the AUR repo), then + # copy $asset_dir's contents back in. The .git directory is left untouched. + if git rev-parse --verify --quiet HEAD >/dev/null; then + echo 'Deleting tracked files' + git ls-tree -r --name-only -z HEAD | xargs -0 -r rm -fv + fi + echo "Mirroring $asset_dir into /tmp/local-repo" + # --filter=':- .gitignore' makes rsync honour any .gitignore files in $asset_dir. + rsync -av --filter=':- .gitignore' --exclude=.git "${asset_dir%/}/" /tmp/local-repo/ else - { - echo "Copying $pkgbuild" - cp -v "$pkgbuild" /tmp/local-repo/PKGBUILD - } - # shellcheck disable=SC2086 - # Ignore quote rule because we need to expand glob patterns to copy $assets - if [[ -n "$assets" ]]; then - echo 'Copying' $assets - cp -rvt /tmp/local-repo/ $assets - fi + { + echo "Copying $pkgbuild" + cp -v "$pkgbuild" /tmp/local-repo/PKGBUILD + } + # shellcheck disable=SC2086 + # Ignore quote rule because we need to expand glob patterns to copy $assets + if [[ -n "$assets" ]]; then + echo 'Copying' $assets + cp -rvt /tmp/local-repo/ $assets + fi fi echo '::endgroup::' if [ "$updpkgsums" == "true" ]; then - echo '::group::Updating checksums' - cd /tmp/local-repo/ - updpkgsums - echo '::endgroup::' + echo '::group::Updating checksums' + cd /tmp/local-repo/ + updpkgsums + echo '::endgroup::' fi if [ "$test" == "true" ]; then - echo '::group::Building package with makepkg' - cd /tmp/local-repo/ - makepkg "${test_flags[@]}" - echo '::endgroup::' + echo '::group::Building package with makepkg' + cd /tmp/local-repo/ + makepkg "${test_flags[@]}" + echo '::endgroup::' fi echo '::group::Generating .SRCINFO' @@ -133,40 +133,40 @@ makepkg --printsrcinfo >.SRCINFO echo '::endgroup::' if [ -n "$post_process" ]; then - echo '::group::Executing post process commands' - cd /tmp/local-repo/ - eval "$post_process" - echo '::endgroup::' + echo '::group::Executing post process commands' + cd /tmp/local-repo/ + eval "$post_process" + echo '::endgroup::' fi echo '::group::Committing files to the repository' if [[ -z "$assets" && -z "$asset_dir" ]]; then - # When neither $assets nor $asset_dir are set, we can add just PKGBUILD and .SRCINFO - # This is to prevent unintended behaviour and maintain backwards compatibility - git add -fv PKGBUILD .SRCINFO + # When neither $assets nor $asset_dir are set, we can add just PKGBUILD and .SRCINFO + # This is to prevent unintended behaviour and maintain backwards compatibility + git add -fv PKGBUILD .SRCINFO else - # We cannot just re-use $assets because it contains absolute paths outside repository. - # For $asset_dir we also need to stage deletions of files removed from the mirror. - # In both cases `git add --all` stages every change in the repository. - git add --all - # PKGBUILD and .SRCINFO are mandatory for every AUR package, and .SRCINFO is - # always (re)generated above. `git add --all` honours .gitignore, so a - # .gitignore present in the repository (e.g. one mirrored in from $asset_dir) - # could silently exclude them. Force-add to guarantee both are staged. - git add -fv PKGBUILD .SRCINFO + # We cannot just re-use $assets because it contains absolute paths outside repository. + # For $asset_dir we also need to stage deletions of files removed from the mirror. + # In both cases `git add --all` stages every change in the repository. + git add --all + # PKGBUILD and .SRCINFO are mandatory for every AUR package, and .SRCINFO is + # always (re)generated above. `git add --all` honours .gitignore, so a + # .gitignore present in the repository (e.g. one mirrored in from $asset_dir) + # could silently exclude them. Force-add to guarantee both are staged. + git add -fv PKGBUILD .SRCINFO fi case "$allow_empty_commits" in true) - git commit --allow-empty -m "$commit_message" - ;; + git commit --allow-empty -m "$commit_message" + ;; false) - git diff-index --quiet HEAD || git commit -m "$commit_message" # use `git diff-index --quiet HEAD ||` to avoid error - ;; + git diff-index --quiet HEAD || git commit -m "$commit_message" # use `git diff-index --quiet HEAD ||` to avoid error + ;; *) - echo "::error::Invalid Value: inputs.allow_empty_commits is neither 'true' nor 'false': '$allow_empty_commits'" - exit 2 - ;; + echo "::error::Invalid Value: inputs.allow_empty_commits is neither 'true' nor 'false': '$allow_empty_commits'" + exit 2 + ;; esac echo '::endgroup::' @@ -174,14 +174,14 @@ echo '::group::Publishing the repository' git remote add aur "ssh://aur@aur.archlinux.org/${pkgname}.git" case "$force_push" in true) - git push -v --force aur master - ;; + git push -v --force aur master + ;; false) - git push -v aur master - ;; + git push -v aur master + ;; *) - echo "::error::Invalid Value: inputs.force_push is neither 'true' nor 'false': '$force_push'" - exit 3 - ;; + echo "::error::Invalid Value: inputs.force_push is neither 'true' nor 'false': '$force_push'" + exit 3 + ;; esac echo '::endgroup::' From 0e9f36a1e2b42ae245c2fa3c34e9ccdb7187bc9b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 13 Jul 2026 19:47:39 +0000 Subject: [PATCH 4/4] style: use 2-space indentation for shell scripts Revert the shell/bash indent_size back to 2 (the repo-wide default), so the [*.{sh,bash}] override is no longer needed and is removed. 2-space keeps the change minimal: build.sh was already 76 lines of 2-space indentation versus only 11 tab-indented lines, so standardizing on 2 touches ~26 lines whereas 4 would re-indent ~178 (and scatter git blame across the whole script). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01F6dDAK5KXrso5SxGiwFFEk --- .editorconfig | 3 - build.sh | 174 +++++++++++++++++++++++++------------------------- 2 files changed, 87 insertions(+), 90 deletions(-) diff --git a/.editorconfig b/.editorconfig index 14ce959..79fe802 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,6 +6,3 @@ indent_size = 2 end_of_line = lf charset = utf-8 insert_final_newline = true - -[*.{sh,bash}] -indent_size = 4 diff --git a/build.sh b/build.sh index 256bc17..3a9cca4 100755 --- a/build.sh +++ b/build.sh @@ -20,39 +20,39 @@ force_push=$INPUT_FORCE_PUSH ssh_keyscan_types=$INPUT_SSH_KEYSCAN_TYPES assert_non_empty() { - name=$1 - value=$2 - if [[ -z "$value" ]]; then - echo "::error::Invalid Value: $name is empty." >&2 - exit 1 - fi + name=$1 + value=$2 + if [[ -z "$value" ]]; then + echo "::error::Invalid Value: $name is empty." >&2 + exit 1 + fi } assert_non_empty inputs.pkgname "$pkgname" if [[ -n "$asset_dir" ]]; then - # asset_dir is the full source of truth for the repository, so it is - # mutually exclusive with both pkgbuild and assets. - if [[ -n "$pkgbuild" ]]; then - echo "::error::Invalid Value: inputs.asset_dir and inputs.pkgbuild are mutually exclusive." >&2 - exit 1 - fi - if [[ -n "$assets" ]]; then - echo "::error::Invalid Value: inputs.asset_dir and inputs.assets are mutually exclusive." >&2 - exit 1 - fi - if [[ ! -d "$asset_dir" ]]; then - echo "::error::Invalid Value: inputs.asset_dir ('$asset_dir') is not a directory." >&2 - exit 1 - fi - if [[ ! -f "$asset_dir/PKGBUILD" ]]; then - echo "::error::Invalid Value: inputs.asset_dir ('$asset_dir') does not contain a PKGBUILD." >&2 - exit 1 - fi - # Resolve to an absolute path now, while we are still in the workspace, so the - # later `cd /tmp/local-repo` does not change how a relative asset_dir resolves. - asset_dir=$(realpath "$asset_dir") + # asset_dir is the full source of truth for the repository, so it is + # mutually exclusive with both pkgbuild and assets. + if [[ -n "$pkgbuild" ]]; then + echo "::error::Invalid Value: inputs.asset_dir and inputs.pkgbuild are mutually exclusive." >&2 + exit 1 + fi + if [[ -n "$assets" ]]; then + echo "::error::Invalid Value: inputs.asset_dir and inputs.assets are mutually exclusive." >&2 + exit 1 + fi + if [[ ! -d "$asset_dir" ]]; then + echo "::error::Invalid Value: inputs.asset_dir ('$asset_dir') is not a directory." >&2 + exit 1 + fi + if [[ ! -f "$asset_dir/PKGBUILD" ]]; then + echo "::error::Invalid Value: inputs.asset_dir ('$asset_dir') does not contain a PKGBUILD." >&2 + exit 1 + fi + # Resolve to an absolute path now, while we are still in the workspace, so the + # later `cd /tmp/local-repo` does not change how a relative asset_dir resolves. + asset_dir=$(realpath "$asset_dir") else - assert_non_empty inputs.pkgbuild "$pkgbuild" + assert_non_empty inputs.pkgbuild "$pkgbuild" fi assert_non_empty inputs.commit_username "$commit_username" assert_non_empty inputs.commit_email "$commit_email" @@ -88,43 +88,43 @@ echo '::endgroup::' echo '::group::Copying files into /tmp/local-repo' if [[ -n "$asset_dir" ]]; then - cd /tmp/local-repo - # Mirror $asset_dir into the repo: first delete everything currently tracked - # (so files removed from $asset_dir are also removed from the AUR repo), then - # copy $asset_dir's contents back in. The .git directory is left untouched. - if git rev-parse --verify --quiet HEAD >/dev/null; then - echo 'Deleting tracked files' - git ls-tree -r --name-only -z HEAD | xargs -0 -r rm -fv - fi - echo "Mirroring $asset_dir into /tmp/local-repo" - # --filter=':- .gitignore' makes rsync honour any .gitignore files in $asset_dir. - rsync -av --filter=':- .gitignore' --exclude=.git "${asset_dir%/}/" /tmp/local-repo/ + cd /tmp/local-repo + # Mirror $asset_dir into the repo: first delete everything currently tracked + # (so files removed from $asset_dir are also removed from the AUR repo), then + # copy $asset_dir's contents back in. The .git directory is left untouched. + if git rev-parse --verify --quiet HEAD >/dev/null; then + echo 'Deleting tracked files' + git ls-tree -r --name-only -z HEAD | xargs -0 -r rm -fv + fi + echo "Mirroring $asset_dir into /tmp/local-repo" + # --filter=':- .gitignore' makes rsync honour any .gitignore files in $asset_dir. + rsync -av --filter=':- .gitignore' --exclude=.git "${asset_dir%/}/" /tmp/local-repo/ else - { - echo "Copying $pkgbuild" - cp -v "$pkgbuild" /tmp/local-repo/PKGBUILD - } - # shellcheck disable=SC2086 - # Ignore quote rule because we need to expand glob patterns to copy $assets - if [[ -n "$assets" ]]; then - echo 'Copying' $assets - cp -rvt /tmp/local-repo/ $assets - fi + { + echo "Copying $pkgbuild" + cp -v "$pkgbuild" /tmp/local-repo/PKGBUILD + } + # shellcheck disable=SC2086 + # Ignore quote rule because we need to expand glob patterns to copy $assets + if [[ -n "$assets" ]]; then + echo 'Copying' $assets + cp -rvt /tmp/local-repo/ $assets + fi fi echo '::endgroup::' if [ "$updpkgsums" == "true" ]; then - echo '::group::Updating checksums' - cd /tmp/local-repo/ - updpkgsums - echo '::endgroup::' + echo '::group::Updating checksums' + cd /tmp/local-repo/ + updpkgsums + echo '::endgroup::' fi if [ "$test" == "true" ]; then - echo '::group::Building package with makepkg' - cd /tmp/local-repo/ - makepkg "${test_flags[@]}" - echo '::endgroup::' + echo '::group::Building package with makepkg' + cd /tmp/local-repo/ + makepkg "${test_flags[@]}" + echo '::endgroup::' fi echo '::group::Generating .SRCINFO' @@ -133,40 +133,40 @@ makepkg --printsrcinfo >.SRCINFO echo '::endgroup::' if [ -n "$post_process" ]; then - echo '::group::Executing post process commands' - cd /tmp/local-repo/ - eval "$post_process" - echo '::endgroup::' + echo '::group::Executing post process commands' + cd /tmp/local-repo/ + eval "$post_process" + echo '::endgroup::' fi echo '::group::Committing files to the repository' if [[ -z "$assets" && -z "$asset_dir" ]]; then - # When neither $assets nor $asset_dir are set, we can add just PKGBUILD and .SRCINFO - # This is to prevent unintended behaviour and maintain backwards compatibility - git add -fv PKGBUILD .SRCINFO + # When neither $assets nor $asset_dir are set, we can add just PKGBUILD and .SRCINFO + # This is to prevent unintended behaviour and maintain backwards compatibility + git add -fv PKGBUILD .SRCINFO else - # We cannot just re-use $assets because it contains absolute paths outside repository. - # For $asset_dir we also need to stage deletions of files removed from the mirror. - # In both cases `git add --all` stages every change in the repository. - git add --all - # PKGBUILD and .SRCINFO are mandatory for every AUR package, and .SRCINFO is - # always (re)generated above. `git add --all` honours .gitignore, so a - # .gitignore present in the repository (e.g. one mirrored in from $asset_dir) - # could silently exclude them. Force-add to guarantee both are staged. - git add -fv PKGBUILD .SRCINFO + # We cannot just re-use $assets because it contains absolute paths outside repository. + # For $asset_dir we also need to stage deletions of files removed from the mirror. + # In both cases `git add --all` stages every change in the repository. + git add --all + # PKGBUILD and .SRCINFO are mandatory for every AUR package, and .SRCINFO is + # always (re)generated above. `git add --all` honours .gitignore, so a + # .gitignore present in the repository (e.g. one mirrored in from $asset_dir) + # could silently exclude them. Force-add to guarantee both are staged. + git add -fv PKGBUILD .SRCINFO fi case "$allow_empty_commits" in true) - git commit --allow-empty -m "$commit_message" - ;; + git commit --allow-empty -m "$commit_message" + ;; false) - git diff-index --quiet HEAD || git commit -m "$commit_message" # use `git diff-index --quiet HEAD ||` to avoid error - ;; + git diff-index --quiet HEAD || git commit -m "$commit_message" # use `git diff-index --quiet HEAD ||` to avoid error + ;; *) - echo "::error::Invalid Value: inputs.allow_empty_commits is neither 'true' nor 'false': '$allow_empty_commits'" - exit 2 - ;; + echo "::error::Invalid Value: inputs.allow_empty_commits is neither 'true' nor 'false': '$allow_empty_commits'" + exit 2 + ;; esac echo '::endgroup::' @@ -174,14 +174,14 @@ echo '::group::Publishing the repository' git remote add aur "ssh://aur@aur.archlinux.org/${pkgname}.git" case "$force_push" in true) - git push -v --force aur master - ;; + git push -v --force aur master + ;; false) - git push -v aur master - ;; + git push -v aur master + ;; *) - echo "::error::Invalid Value: inputs.force_push is neither 'true' nor 'false': '$force_push'" - exit 3 - ;; + echo "::error::Invalid Value: inputs.force_push is neither 'true' nor 'false': '$force_push'" + exit 3 + ;; esac echo '::endgroup::'