This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| //Github gh client | |
| //Need GH_TOKEN or GITHUB_TOKEN exported | |
| //BITRISE_PULL_REQUEST = ID of PR | |
| //BITRISEIO_GIT_BRANCH_DEST = Branch against the PR is opened | |
| //BITRISE_BUILD_URL = link of the current pipeline build | |
| // JIRA ID is extract from this pattern from the title : ...(APPS-123455) or ...(BUG-123455)... | |
| pull_request_body=$(gh pr view $BITRISE_PULL_REQUEST --json body -q '.body') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/zsh | |
| source "githooks/android/toolbox.sh" | |
| hook="Commit-msg check" | |
| progress "$hook" | |
| if [[ "$commit_message" =~ $conventionnal_commit_pattern ]]; then | |
| exitWithMessage "$hook failed because it doesn't match to your convention" | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/zsh | |
| source "githooks/android/toolbox.sh" | |
| hook="Prepare-commit-msg check" | |
| progress "$hook" | |
| COMMIT_EDITMSG=$1 | |
| commit_message=$(cat $COMMIT_EDITMSG) | |
| char_count=$(echo $commit_message | wc -m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/zsh | |
| source "githooks/android/toolbox.sh" | |
| hook="Pre-commit check" | |
| progress "$hook" | |
| if [ ! -z "$stagedKotlinFiles" ]; then | |
| #run autoformatter | |
| progress "Autoreformatting the code..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Swiftlint | |
| swiftlint.config_file = "#{ENV['BITRISE_SOURCE_DIR']}/.swiftlint.yml" | |
| swiftlint.binary_path = "/opt/homebrew/bin/swiftlint" #to speed up you CI | |
| swiftlint.strict = true | |
| swiftlint.verbose = true | |
| #swiftlint.filter_issues_in_diff = true #optional now because the baseline support it 🎉 | |
| swiftlint.lint_files(inline_mode: true, additional_swiftlint_args: "--baseline #{ENV['BITRISE_SOURCE_DIR']}/path/to/baseline.json") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Get Swift files that are staged | |
| staged_files=$(git diff --cached --name-only --diff-filter=d | grep ".swift$") | |
| # Check if we have any Swift files to format | |
| if [[ "$staged_files" = "" ]]; then | |
| echo "swiftlint skipped: No source files to lint." | |
| exit 0 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| #filter unstaged swift files | |
| unstaged_swift_files_relative=$(git status --porcelain | grep -e '^[^\sD]' | grep '\.swift$' | cut -c4- | grep -v '^githooks/') | |
| #filter staged swift files | |
| staged_swift_files_relative=$(git diff --cached --name-only --diff-filter=d | grep '\.swift$' | grep -v '^githooks/') | |
| #Removed duplication with both staged and unstaged files | |
| all_swift_files=$(echo "$staged_swift_files_relative" "$unstaged_swift_files_relative" | sort | uniq) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Get kotlin files that are staged | |
| staged_files=$(git diff --cached --name-only --diff-filter=d | grep ".kt$") | |
| # Check if we have didn't edit any souce files | |
| if [[ "$staged_files" = "" ]]; then | |
| echo "AndroidLint skipped: No source files to format." | |
| exit 0 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Get kotlin files that are staged | |
| staged_files=$(git diff --cached --name-only --diff-filter=d | grep ".kt$") | |
| # Check if we have any Kotlin files to format | |
| if [[ "$staged_files" = "" ]]; then | |
| echo "Android lint skipped: No source files to format." | |
| exit 0 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Get kotlin files that are staged | |
| staged_files=$(git diff --cached --name-only --diff-filter=d | grep ".kt$") | |
| # Check if we have any Kotlin files to lint | |
| if [[ "$staged_files" = "" ]]; then | |
| echo "Detekt skipped: No source files to lint." | |
| exit 0 | |
| fi |
NewerOlder