Description

An Updatecli action defines what happens after a change is detected and validated. While Updatecli’s sources find changes (like a new version), and targets define where to apply them (like a file), actions describe what to do next, such as creating a pull request.

An action is bound to an scm through its scmid, and runs when a target using that same scm pushed a change. Targets working on the local directory, or on another scm, do not trigger it.

An action is only carried out in apply mode with push enabled. updatecli pipeline diff, and updatecli pipeline apply --push=false, describe the action that would be taken, including its title and body, without contacting the forge.

Note
When none of the related targets changed, Updatecli does not simply skip the action: it still looks for a pull request opened by a previous run, so that an update which became obsolete is reported rather than left dangling.

Parameters

NameTypeDescriptionRequired
disablepipelineurlboolean
kindstringkind specifies the actions resource kind
scmidstring
specobjectspec specifies parameters for a specific actions kind
titlestring

Title

An action title is optional. When it is empty, Updatecli falls back to the manifest name, which is why a stable name matters: a title built from a source output would rewrite the pull request title on every run.

See autodiscovery for how this default applies to generated pipelines.

Grouping changes

Actions are grouped by branch, and the branch is derived from the manifest pipelineid. Giving several manifests the same pipelineid therefore collects all their changes into a single branch and a single pull request. See configuration.

Examples

In the follow example, we define an action that creates a pull request on GitHub when Updatecli detected outdated version of golangci-lint in GitHub action workflow files. The action uses the github/pullrequest plugin to create a pull request with specific labels and merge.strategy set to auto.

name: 'deps: Updatecli version used by GitHub action'
pipelineid: golangci-lint
actions:
    default:
        # The syntax {{ source "golangci-lint" }} is used to get the value of the source
        # where golangci-lint represent source id
        title: 'deps: bump golangci-lint to {{ source "golangci-lint" }}'
        kind: github/pullrequest
        spec:
            merge:
                strategy: auto
            labels:
                - chore
                - dependencies
            mergemethod: squash
        scmid: default
scms:
    default:
        kind: github
        spec:
            branch: main
            # commitusingapi is used to commit using the GitHub API
            # when updatecli is running in a GitHub action with the token provided by
            # the GITHUB_TOKEN secret, then the commit are signed.
            commitusingapi: true
            email: bot@updatecli.io
            owner: updatecli
            repository: updatecli
            token: '{{ requiredEnv "GITHUB_TOKEN" }}'
            username: '{{ requiredEnv "GITHUB_ACTOR"}}'
            user: updatecli
        disabled: false
sources:
    golangci-lint:
        name: Get latest Updatecli version
        kind: githubrelease
        spec:
            owner: golangci
            repository: golangci-lint
            token: '{{ requiredEnv "GITHUB_TOKEN" }}'
            username: '{{ requiredEnv "GITHUB_ACTOR"}}'
            versionfilter:
                kind: semver
                pattern: '*'
targets:
    githubaction:
        # Please note that the commit title is generated from the target name
        name: 'deps: bump golangci-lint in GitHub Action to {{ source "golangci-lint" }}'
        kind: yaml
        spec:
            engine: yamlpath
            files:
                - .github/workflows/*
            key: $.jobs.*.steps[?(@.uses =~ /^golangci\/golangci-lint-action/)].with.version
            searchpattern: true
        scmid: default
        sourceid: golangci-lint
version: v0.68.0