---
name: publish-to-git
description: 'Publish files to a git repository'
branding:
  icon: 'git-commit'
  color: 'blue'
inputs:
  repository:
    description: 'Destination repository (default: current repository)'
    default: ''
  branch:
    description: 'Destination branch'
    required: true
  host:
    description: 'Destination git host'
    default: 'github.com'
  github_token:
    description: 'GitHub Token (use `secrets.GITHUB_TOKEN`)'
    required: true
  github_pat:
    description: 'Personal Access Token or other https credentials'
    default: ''
  source_folder:
    description: 'Source folder in workspace to copy (default: workspace root)'
    defaault: ''
  target_folder:
    description: 'Target folder in destination branch to copy to (default: repository root)'
    default: ''
  commit_author:
    description: 'User Name <email@address> (default: [github.actor]@users.noreply.github.com)'
    default: ''
  commit_message:
    description: 'Commit message (default: [workflow] Publish from [repository]:[branch]/[folder])'
    default: ''
  dry_run:
    description: 'Do not push to repository (set to non-empty string to make dry-run)'
    default: ''
  working_directory:
    description: 'Working directory for clone (default: random location in `${HOME}`)'
    default: ''
outputs:
  commit_hash:
    description: 'Hash of the new commit'
  working_directory:
    description: 'Working directory of temporary repository'
runs:
  using: 'docker'
  image: 'Dockerfile'
  args:
    - ${{ inputs.repository }}
    - ${{ inputs.branch }}
    - ${{ inputs.host }}
    - ${{ inputs.github_token }}
    - ${{ inputs.github_pat }}
    - ${{ inputs.source_folder }}
    - ${{ inputs.target_folder }}
    - ${{ inputs.commit_author }}
    - ${{ inputs.commit_message }}
    - ${{ inputs.dry_run }}
    - ${{ inputs.working_directory }}