### Install Mage Source: https://github.com/aevea/commitsar/blob/master/docs/content/contributing/get_started.md Install the mage build tool, which is used for setting up templates and cross-platform commands. ```bash go install github.com/magefile/mage ``` -------------------------------- ### Install Dependencies and Build Assets Source: https://github.com/aevea/commitsar/blob/master/docs/themes/hugo-geekdoc/README.md Install npm packages and run the default Gulp pipeline to build required assets for the Hugo Geekdoc theme. ```Shell npm install ``` ```Shell npx gulp default ``` -------------------------------- ### Minimal Github Action Setup Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/github.md A basic Github Action workflow to run Commitsar on every pull request. Ensure `actions/checkout@v1` is used for this setup. ```yaml name: Linters on: [pull_request] jobs: validate-commits: runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory uses: actions/checkout@v1 - name: Commitsar check uses: aevea/commitsar@v0.11.0 (substitute for the current version) ``` -------------------------------- ### Install Latest Commitsar Version Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/gobinaries.md Installs the latest version of commitsar from gobinaries.com. Ensure curl is installed on your system. ```shell curl -sf https://gobinaries.com/aevea/commitsar | sh ``` -------------------------------- ### Run Commitsar Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/gobinaries.md Executes the commitsar tool. This is the basic command to start the tool. ```shell commitsar ``` -------------------------------- ### Install Specific Commitsar Version Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/gobinaries.md Installs a specific version of commitsar by replacing [@VERSION] with the desired version number. Ensure curl is installed on your system. ```shell curl -sf https://gobinaries.com/aevea/commitsar[@VERSION] | sh ``` -------------------------------- ### Create Git Bundle Source: https://github.com/aevea/commitsar/blob/master/docs/content/contributing/get_started.md Steps to create a git bundle for testing Commitsar. This involves initializing a git repository, making commits, and then bundling all history. ```bash git init commit away git bundle create name_of_repo.bundle --all ``` -------------------------------- ### Download and Run Commitsar Binary (Linux x86_64) Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/binary.md Download the Commitsar binary for Linux x86_64, extract the archive, and run the executable. Ensure you are in the directory where you extracted the binary. ```shell - curl -L -O https://github.com/aevea/commitsar/releases/download/v0.0.2/commitsar_v0.0.2_Linux_x86_64.tar.gz - tar -xzf commitsar_v0.0.2_Linux_x86_64.tar.gz - ./commitsar ``` -------------------------------- ### Global Configuration Settings Source: https://github.com/aevea/commitsar/blob/master/docs/content/configuration/config-file.md Configure global settings like version and verbosity. Verbose mode enables debug logging. ```yaml version: 1 verbose: false ``` -------------------------------- ### Download and Run Commitsar Binary with Repository Path (Linux x86_64) Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/binary.md Download the Commitsar binary for Linux x86_64, extract it, and run the executable specifying a path to the repository. This is useful for analyzing specific Git repositories. ```shell - curl -L -O https://github.com/aevea/commitsar/releases/download/v0.0.2/commitsar_v0.0.2_Linux_x86_64.tar.gz - tar -xzf commitsar_v0.0.2_Linux_x86_64.tar.gz - ./commitsar ./path-to-repo ``` -------------------------------- ### Run Commitsar with a Path Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/gobinaries.md Executes the commitsar tool and specifies a repository path. Use this to analyze a specific directory. ```shell commitsar ./path-to-repo ``` -------------------------------- ### Github Action with Docker Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/github.md Utilizes a Docker image for Commitsar, which can be faster as it avoids building the Docker image within the action. This is recommended for performance. ```yaml name: Linters on: [pull_request] jobs: validate-commits: runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory uses: actions/checkout@v1 - name: Commitsar check uses: docker://aevea/commitsar ``` -------------------------------- ### Run All Tests Source: https://github.com/aevea/commitsar/blob/master/docs/content/contributing/get_started.md Execute all tests for the Commitsar project. This command will clone git bundles and run tests across the entire repository. ```bash mage test ``` -------------------------------- ### Run Commitsar in Docker with Repository Path Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/docker.md Command to run Commitsar in Docker, specifying a repository path. Mounts the current directory and sets it as the working directory. ```sh docker run --rm --name="commitsar" -w /src -v "$(pwd)":/src aevea/commitsar ./path-to-repo ``` -------------------------------- ### Configure Search in Hugo Geekdoc Footer Source: https://github.com/aevea/commitsar/blob/master/docs/themes/hugo-geekdoc/layouts/partials/foot.html Enables and configures the search functionality in the footer. It sets up a search configuration and minifies the search JavaScript file. ```gohtml {{ if default true .Site.Params.GeekdocSearch }} {{ .Scratch.Set "geekdocSearchConfig" .Site.Params.GeekdocSearchConfig }} {{ $searchJSFile := printf "js/%s.search.js" .Language.Lang }} {{ $searchJS := resources.Get "js/search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | fingerprint }} {{ end }} ``` -------------------------------- ### Run Commitsar in Docker Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/docker.md Basic command to run Commitsar in a Docker container. Mounts the current directory to /src and sets it as the working directory. ```sh docker run --rm --name="commitsar" -w /src -v "$(pwd)":/src aevea/commitsar ``` -------------------------------- ### JIRA Pipeline with Checkout at PR HEAD Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/github.md Configures a Github Action for JIRA pipelines, specifically checking out the pull request's HEAD commit instead of the merge commit. Requires `fetch_depth: 0` and setting the `ref` to `github.event.pull_request.head.sha` for full git history. ```yaml validate-commits: runs-on: ubuntu-latest steps: - name: Set up Go 1.13 uses: actions/setup-go@v1 with: go-version: 1.13 - name: Check out code into the Go module directory uses: actions/checkout@v2 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - name: Commitsar check uses: docker://aevea/commitsar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` -------------------------------- ### Image Shortcode Usage Source: https://github.com/aevea/commitsar/blob/master/docs/themes/hugo-geekdoc/layouts/shortcodes/img.html This shortcode processes an image resource, generates different sizes for responsive display, and allows for custom alt text, size, and lazy loading configuration. It supports linking to the original image and displaying credits. ```html {{ $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }} {{ $customAlt := .Get "alt" }} {{ $customSize := .Get "size" }} {{ $lazyLoad := default (default true $.Site.Params.GeekdocImageLazyLoading) (.Get "lazy") }} {{ with $source }} {{ $caption := default .Title $customAlt }} {{ $tiny := (.Resize "320x").RelPermalink }} {{ $small := (.Resize "600x").RelPermalink }} {{ $medium := (.Resize "1200x").RelPermalink }} {{ $large := (.Resize "1800x").RelPermalink }} {{ $size := dict "tiny" $tiny "small" $small "medium" $medium "large" $large }} {{/* TODO: Add responsive image markup here */}} {{/* Example: {{ $caption }} */}} []({{ .RelPermalink }}){{ with $caption -}} {{ . }}{{ with $source.Params.credits }} ({{ . | $.Page.RenderString }}){{ end }} {{ end }} {{ end }} ``` -------------------------------- ### Configure Anchor Copy in Hugo Geekdoc Footer Source: https://github.com/aevea/commitsar/blob/master/docs/themes/hugo-geekdoc/layouts/partials/foot.html Conditionally enables the anchor copy feature for headings in the footer configuration. ```gohtml {{ if default true .Site.Params.GeekdocAnchorCopy }} {{ end }} ``` -------------------------------- ### Gitlab CI Job for Commitsar Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/gitlab.md Include this job in your .gitlab-ci.yml file to run Commitsar as part of your CI pipeline. Ensure the image is correctly specified. If you encounter 'reference not found' errors, consider increasing the GIT_DEPTH variable. ```yaml validate-commits: stage: test image: aevea/commitsar script: - git fetch origin master - commitsar ``` -------------------------------- ### Minimal CircleCI Job for Commit Validation Source: https://github.com/aevea/commitsar/blob/master/docs/content/usage/circleci.md Configure a CircleCI job to use the commitsar Docker image and run the tool. Ensure the 'checkout' step is included to fetch your repository code. ```yaml validate-commits: docker: - image: aevea/commitsar steps: - checkout - run: commitsar ``` -------------------------------- ### Commitsar Command with Commit Hashes Source: https://github.com/aevea/commitsar/blob/master/docs/content/configuration/flags.md Use commit hashes to specify the range of commits to check. If only one hash is provided, it is treated as the 'to' commit. ```bash commitsar 7dbf3e7db93ae2e02902cae9d2f1de1b1e5c8c92...d0240d3ed34685d0a5329b185e120d3e8c205be4 ``` -------------------------------- ### Conventional Pull Request Style Source: https://github.com/aevea/commitsar/blob/master/docs/content/configuration/config-file.md Enable the conventional pull request title checking pipeline by setting 'conventional' to true. This is useful for teams using squash commits. ```yaml pull_request: conventional: true ``` -------------------------------- ### JIRA Pull Request Style Source: https://github.com/aevea/commitsar/blob/master/docs/content/configuration/config-file.md Enable the JIRA pull request title checking pipeline by setting 'jira_title' to true. Optionally, specify 'jira_keys' to scope the checks to specific JIRA project keys. ```yaml pull_request: jira_title: true jira_keys: - TEST - TSLA ``` -------------------------------- ### Commit Style Configuration Source: https://github.com/aevea/commitsar/blob/master/docs/content/configuration/config-file.md Define commit style rules, including disabling checks, enforcing strictness, limiting commits, or checking all history. The upstream branch for comparison can also be specified. ```yaml commits: disabled: false strict: true limit: 0 all: false upstreamBranch: origin/master ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.