PHPackages                             devshop/yaml-tasks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. devshop/yaml-tasks

ActiveComposer-plugin

devshop/yaml-tasks
==================

Plugin to run commands from a YML file and pass to GitHub commit status API.

2.x-dev(3y ago)05.1k1[1 PRs](https://github.com/devshop-packages/yaml-tasks/pulls)MITPHPCI failing

Since Mar 19Pushed 1y agoCompare

[ Source](https://github.com/devshop-packages/yaml-tasks)[ Packagist](https://packagist.org/packages/devshop/yaml-tasks)[ Docs](https://getdevshop.com)[ RSS](/packages/devshop-yaml-tasks/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelogDependencies (10)Versions (217)Used By (0)

Yaml Tasks
==========

[](#yaml-tasks)

**Formerly [Yaml Tests](https://github.com/provision-ops/yaml-tests)**

Yaml Tasks is a simple composer plugin that make it as simple as possible to define and run a set of commands using YML.

It provides a composer command and an executable script that simply reads a YML file and runs each line as a process.

In addition, it integrates with GitHub's Commit Status API. If `GITHUB_TOKEN` is specified, the status of each command will be posted back to GitHub.com, to be displayed on the pull request.

The output is rendered in a way to be easier to read, and proper exit code returns if a single process fails.

Get Started
-----------

[](#get-started)

1. Add YamlTasks to your project.

    ```
     cd my-composer-project
     composer require devshop/yaml-tasks

    ```
2. Create a `tests.yml` file that looks something like this:

    ```
     myproject/php/lint: find src -name '*.php' -print0 | xargs -0 -n1 php -l
     myproject/php/cs:
       description: CodeSniffer
       command: bin/phpcs --standard=PSR2 -n  --colors
     myproject/debug/environment: |
       env

    ```
3. Run the `yaml-tasks` composer command or the `yaml-tasks` bin script:

    ```
     composer yaml-tasks
     bin/yaml-tasks

    ```

    or

    ```
     composer y

    ```

### Global Install

[](#global-install)

```
composer global require devshop/yaml-tasks
```

To confirm the command is installed, ask for help:

```
composer yaml-tests --help
```

Or run the `bin/yaml-tasks` command:

```
bin/yaml-tasks
```

GitHub Integration
------------------

[](#github-integration)

If you pass `yaml-tasks` a GitHub Token, it will send the test results as "commit status" indicators.

There are 3 ways to pass the GitHub Token to YamlTasks:

1. Use the `--github-token` command line option. Don't use this in CI, or you might expose your GitHub token in logs.
2. Set a GITHUB\_TOKEN environment variable. This is pretty simple in Docker, but can be a challenge if your tasks get run in different environments.
3. **Recommended:** Create a `.env` file in your repo, or in your user's home directory:

    ```
    GITHUB_TOKEN=abcdefg

    ```

    There is a `.env.example` file in this directory you can use as an example.

Writing tasks
-------------

[](#writing-tasks)

### Create tasks.yml file

[](#create-tasksyml-file)

By default the `composer yaml-tasks` command looks for a tasks.yml file in the project root. You can also pass a path using the `--tasks-file` option.

The `tasks.yml` file is read as a simple collection of commands. The key can be any string, as long as it is unique in the test suite.

```
test/dir: pwd
test/environment: env
```

You can also include commands in a list:

```
lint:
  - find src -name '*.php' -print0 | xargs -0 -n1 php -l
  - find web/modules/custom -name '*.php' -print0 | xargs -0 -n1 php -l
  - find tasks/src -name '*.php' -print0 | xargs -0 -n1 php -l
```

You can include a description for each test like:

```
debug:
  command: env
  description: Current Environment
```

### Commands in tasks.yml

[](#commands-in-tasksyml)

Yaml Tasks work like [Composer Scripts](https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands): If your project has the `config.bin-dir` set in `composer.json`, Composer will automatically add that directory to the PATH when scripts or other commands are run.

For example, you can include PHPUnit and call it without specifying the full path in composer scripts or `tasks.yml`

`composer.json`:

```
{
    "config": {
        "bin-dir": "bin/"
    },
    "require": {
        "devshop/yaml-tasks": "^1.5",
        "phpunit/phpunit": "^8.1"
    },
    "scripts": {
        "test": [
            "which phpunit",
            "phpunit --version"
        ]
    }
}
```

Having the `scripts.test` section in `composer.json` creates a composer command called `composer test`.

`tasks.yml`:

```
test/debug:
  - which phpunit
  - phpunit --version
```

If you want to only maintain one set of scripts, you can reference composer scripts in `tasks.yml`:

`tasks.yml`:

```
test/debug: composer test
```

Running tasks
-------------

[](#running-tasks)

Once the `tasks.yml` file is in place, and the `composer yaml-tasks` command is available, you can trigger test runs.

### Dry Runs vs Normal

[](#dry-runs-vs-normal)

This plugin was also designed to pass these tasks as "Commit Statuses" on GitHub. This allows us to tag the results to the specific commit, pass or fail.

If the environment variable `GITHUB_TOKEN` or the command line option `--github-token` is NOT set, the `--dry-run` option will be forced.

Use the `--dry-run` option if you have a token set but do not want to post test results to GitHub.

Run `composer yaml-tasks` or, just like all composer commands, you can use shortcuts like `compose y`.

```
composer yaml-tasks
```

The output will look something like this:

[![Test Run](https://github.com/devshop-packages/yaml-tasks/raw/develop/assets/test-run.png?raw=true)](https://github.com/devshop-packages/yaml-tasks/blob/develop/assets/test-run.png?raw=true)

And you will get a nice summary at the end like this:

[![Test Run](https://github.com/devshop-packages/yaml-tasks/raw/develop/assets/test-result.png?raw=true)](https://github.com/devshop-packages/yaml-tasks/blob/develop/assets/test-result.png?raw=true)

Yaml-Tasks executable
---------------------

[](#yaml-tasks-executable)

There is now a "bin" for yaml-tasks, allowing the command to be run by itself.

If you require `devshop/yaml-tasks`, you will see a symlink to `yaml-tasks` in your `bin-dir`.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~70 days

Recently: every ~0 days

Total

16

Last Release

1194d ago

Major Versions

1.x-dev → 2.x-dev2023-02-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/10539fb9e887c35b626eba70c97dd9d53ba14e987d4f129b55a488664a834eca?d=identicon)[jonpugh](/maintainers/jonpugh)

---

Top Contributors

[![jonpugh](https://avatars.githubusercontent.com/u/106420?v=4)](https://github.com/jonpugh "jonpugh (86 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/devshop-yaml-tasks/health.svg)

```
[![Health](https://phpackages.com/badges/devshop-yaml-tasks/health.svg)](https://phpackages.com/packages/devshop-yaml-tasks)
```

###  Alternatives

[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[google/cloud

Google Cloud Client Library

1.2k16.2M53](/packages/google-cloud)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[j0k3r/graby

Graby helps you extract article content from web pages

384349.6k2](/packages/j0k3r-graby)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
