Action

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.

Parameters

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

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 a specific labels, merge method, automerge set to true.

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:
            automerge: true
            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

Top