1
1
mirror of https://github.com/joshdk/drone-skip-pipeline synced 2024-11-25 12:27:37 +01:00
🤖 DroneCI plugin to skip pipelines based on files changes
Go to file
2022-08-04 00:23:51 -04:00
.github/workflows ci: lint code with golangci-lint (#11) 2021-11-14 18:27:59 -08:00
.dockerignore feat: dockerfile (#3) 2021-11-13 18:13:29 -08:00
.golangci.yml ci: lint code with golangci-lint (#11) 2021-11-14 18:27:59 -08:00
Dockerfile chore: upgrade component versions (#15) 2022-08-04 00:23:51 -04:00
go.mod chore: upgrade component versions (#15) 2022-08-04 00:23:51 -04:00
go.sum chore: upgrade component versions (#15) 2022-08-04 00:23:51 -04:00
LICENSE.txt docs: license and readme (#1) 2021-11-13 14:40:58 -08:00
main.go chore: upgrade component versions (#15) 2022-08-04 00:23:51 -04:00
README.md chore: upgrade component versions (#15) 2022-08-04 00:23:51 -04:00

License Actions Releases

DroneCI Skip Pipeline

🤖 DroneCI plugin to skip pipelines based on files changes

Motivations

This DroneCI plugin enables you skip (or short-circuit) a pipeline based on the files changed as part of the current pull request being built. You can avoid running a given pipeline if none of the files involved in that pipeline have changed. This plugin also uses the Github API in order to determine the list of files changes, and as such can be used without needing a clone step to be run first.

Usage

This plugin can be added to your .drone.yml as a new step within an existing pipeline.

steps:
- name: debug
  image: ghcr.io/joshdk/drone-skip-pipeline:v0.2.0
  settings:
    rules:
    - package.json
    - app/

If your repository is private, a GITHUB_TOKEN environment variable must also be configured.

steps:
- name: drone-skip-pipeline
  image: ghcr.io/joshdk/drone-skip-pipeline:v0.2.0
  ...
  environment:
    GITHUB_TOKEN:
      from_secret: GITHUB_TOKEN

You can then reconfigure any existing clone steps to depend on this new step.

- name: clone
  ...
  depends_on:
  - drone-skip-pipeline

You must also disable automatic cloning at the pipeline level.

clone:
  disable: true

In order to provide some level of feature parity for older versions of DroneCI that do not support pipeline skipping, you can configure the touch setting with a filename that will be created in the event that the pipeline should be skipped.

The existence of file can then be checked for in subsequent steps, where commands can then be skipped where appropriate.

You may also need to configure the failure property, in order to ignore the non-zero exit code.

steps:
- name: debug
  image: ghcr.io/joshdk/drone-skip-pipeline:v0.2.0
  failure: ignore
  settings:
    rules:
    - package.json
    - app/
    touch: .skip-pipeline

License

This code is distributed under the MIT License, see LICENSE.txt for more information.