Woodpecker CI Plugins
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

wp-git-action

Build Status Docker Hub Quay.io Go Report Card GitHub contributors Source: GitHub License: Apache-2.0

Woodpecker CI plugin to perform git actions.

Usage

steps:
  - name: commit changelog
    image: quay.io/thegeeklab/wp-git-action
    settings:
      action:
        - commit
        - push
      netrc_password: ghp_randomstring
      author_name: octobot
      author_email: octobot@example.com
      message: "[skip ci] update changelog"

Parameters

action required list

Git action to execute.

Supported actions: clone | commit | push | pages. Specified actions are executed in the specified order

  • clone: Clones the repository in remote_url and checks out the branch to path.
  • commit: Adds a commit to the default repository or the repository in remote_url.
  • push: Pushes all commits to the default repository or the repository set in remote_url.
  • pages: The pages action is a special action that cannot be combined with other actions. It is intended for use for GitHub pages. It synchronizes the contents of pages_directory with the target branch using rsync and pushes the changes automatically.
Default: none
author_email required string
Git author email.
Default: none
author_name required string
Git author name.
Default: none
branch optional string
Name of the git source branch.
Default: main
empty_commit optional bool

Allow empty commits.

Usually recording a commit that has the exact same tree as its sole parent commit is a mistake, and those commits are not allowed by default.

Default: false
followtags optional bool

Follow tags for pushes to remote repository.

Push all the refs that would be pushed without this option, and also push annotated tags in refs/tags that are missing from the remote.

Default: false
force optional bool
Enable force push to remote repository.
Default: false
insecure_skip_verify optional bool

Skip SSL verification.

Activating this option is insecure and should be avoided in most cases.

Default: false
log_level optional string
Plugin log level.
Default: info
message optional string
Commit message.
Default: [skip ci] commit dirty state
netrc_machine optional string
Netrc remote machine name.
Default: github.com
netrc_password optional string
Netrc login password on the remote machine.
Default: none
netrc_username optional string
Netrc login user on the remote machine.
Default: token
no_verify optional bool
Bypass the pre-commit and commit-msg hooks.
Default: false
pages_delete optional bool

Add delete flag to pages rsync command.

When set to true, the --delete flag is added to the rsync command to remove files from the branch that do not exist in the pages_directory either.

Default: true
pages_directory optional string
Source directory to be synchronized with the pages branch.
Default: docs/
pages_exclude optional list
Files or directories to exclude from the pages rsync command.
Default: none
path optional string
Path to clone git repository.
Default: none
remote_url optional string
Url of the remote repository.
Default: none
ssh_key optional string
Ssh private key for the remote repository.
Default: none

Examples

Publish GitHub pages

The plugin can be used to publish GitHub pages to the pages branch. Remember that the pages action cannot be combined with other actions.

steps:
  - name: publish
    image: quay.io/thegeeklab/wp-git-action
    settings:
      action:
        - pages
      author_email: bot@texample.com
      author_name: octocat-bot
      message: "update pages"
      branch: gh-pages
      pages_directory: docs/
      netrc_password: ghp_randomstring

Build

Build the binary with the following command:

make build

Build the Container image with the following command:

docker build --file Containerfile.multiarch --tag thegeeklab/wp-git-action .

Test

docker run --rm \
  -e PLUGIN_ACTION=clone \
  -e PLUGIN_BRANCH=master \
  -e PLUGIN_AUTHOR_EMAIL=octocat@example.copm \
  -e PLUGIN_AUTHOR_NAME=octocat \
  -e PLUGIN_REMOTE_URL=https://github.com/octocat/Hello-World \
  -w /tmp \
  thegeeklab/wp-git-action