Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
354.2K

git-commit git-commit

Commit and push changes to repository

arguments

  • add - Add file contents to the git index
  • allow_empty - Allow empty commit
  • base_branch - Changes the base branch git-commit interacts with
  • commit_message - Text body of the comment to be created
  • force_push - force git push (false by default)
  • git - The name of the git integration you want to use. If left empty, Codefresh will attempt to use the git provider that was used during account sign-up. Note that this might have unexpected results if you are changing your Git integrations.
  • git_user_email - Git user email
  • git_user_name - The username the commit comes from
  • gpg_key_id - GPG key ID (for example `3AA5C34371567BD2`)
  • gpg_secret_key - GPG secret key (base64 encoded; for example `gpg -a --export-secret-keys 3AA5C34371567BD2 | base64 -w0`)
  • rebase - pull remote changes with rebase flag before push
  • repo - path of the repository without the domain name in the form of my_username/my_repo
  • use_ssh - Is use ssh or https (ssh key will be taken from git integration defined in git argument)
  • working_directory - The directory to which the repository is cloned. It can be an explicit path in the container’s file system, or a variable that references another step. The default value is '/codefresh/volume/${{CF_REPO_NAME}}'
    commit_and_push:
  title: Commit changes and push
  type: git-commit
  arguments:
    repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
    git: github
    working_directory: '/codefresh/volume/${{CF_REPO_NAME}}'
    commit_message: Some commit message
    git_user_name: git-user-name
    git_user_email: git-user@email.com
    allow_empty: false
    rebase: true
    base_branch: feature
    add:
      - file1.txt
      - file2.txt
      - ./dir3

  
    gpg_signed_commit:
  title: Sign commit with GPG and push
  type: git-commit
  arguments:
    repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
    git: github
    working_directory: '/codefresh/volume/${{CF_REPO_NAME}}'
    commit_message: Some commit message
    git_user_name: git-user-name
    git_user_email: git-user@email.com
    allow_empty: false
    gpg_key_id: '${{GPG_KEY_ID}}'
    gpg_secret_key: '${{GPG_SECRET_KEY}}'
    add:
      - file1.txt
      - file2.txt
      - ./dir3

  
github.com
Dima Golomozy
Dec 8, 2023