<commit_before>---
name: ci

on:
  pull_request:
  push:
    branches:
      - master

jobs:
  delivery:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Run Chef Delivery
        uses: actionshub/chef-delivery@main
        env:
          CHEF_LICENSE: accept-no-persist

  yamllint:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Run yaml Lint
        uses: actionshub/yamllint@main

  mdl:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Run Markdown Lint
        uses: actionshub/markdownlint@1.2.0

  dokken:
    needs: [mdl, yamllint, delivery]
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os:
          - 'centos-8'
          - 'debian-10'
          - 'ubuntu-2004'
        suite:
          - 'default'
      fail-fast: false

    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Install Chef
        uses: actionshub/chef-install@main
      - name: Dokken
        uses: actionshub/kitchen-dokken@master
        env:
          CHEF_LICENSE: accept-no-persist
          KITCHEN_LOCAL_YAML: kitchen.dokken.yml
        with:
          suite: ${{ matrix.suite }}
          os: ${{ matrix.os }}

  release:
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    needs: [mdl, yamllint, delivery, dokken]
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Setup SSH agent
        uses: webfactory/ssh-agent@v0.4.1
        with:
          ssh-private-key: ${{ secrets.CI_SSH_PRIVATE_KEY }}
      - name: Install Chef
        uses: actionshub/chef-install@main
      - name: Release
        run: |
          COOKBOOK_NAME=$(grep "^name" metadata.rb | awk '{print $2}' | sed s/\'//g)
          COOKBOOK_VERSION=$(grep "^version" metadata.rb | awk '{print $2}' | sed s/\'//g)
          echo "NAME: ${COOKBOOK_NAME}"
          echo "VERSION: ${COOKBOOK_VERSION}"
          if git tag | grep -q v$COOKBOOK_VERSION; then
            echo "Cookbook version is already tagged, skipping job"
            exit 0
          fi
          if knife supermarket show $COOKBOOK_NAME $COOKBOOK_VERSION | grep -q $COOKBOOK_VERSION; then
            echo "Cookbook version already exists on supermarket, skipping job"
            exit 0
          fi
          git config --global user.email "<EMAIL>"<commit_msg>This needs a negate of we use '-q' for grep<commit_after>---
name: ci

on:
  pull_request:
  push:
    branches:
      - master

jobs:
  delivery:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Run Chef Delivery
        uses: actionshub/chef-delivery@main
        env:
          CHEF_LICENSE: accept-no-persist

  yamllint:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Run yaml Lint
        uses: actionshub/yamllint@main

  mdl:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Run Markdown Lint
        uses: actionshub/markdownlint@1.2.0

  dokken:
    needs: [mdl, yamllint, delivery]
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os:
          - 'centos-8'
          - 'debian-10'
          - 'ubuntu-2004'
        suite:
          - 'default'
      fail-fast: false

    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Install Chef
        uses: actionshub/chef-install@main
      - name: Dokken
        uses: actionshub/kitchen-dokken@master
        env:
          CHEF_LICENSE: accept-no-persist
          KITCHEN_LOCAL_YAML: kitchen.dokken.yml
        with:
          suite: ${{ matrix.suite }}
          os: ${{ matrix.os }}

  release:
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    needs: [mdl, yamllint, delivery, dokken]
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Setup SSH agent
        uses: webfactory/ssh-agent@v0.4.1
        with:
          ssh-private-key: ${{ secrets.CI_SSH_PRIVATE_KEY }}
      - name: Install Chef
        uses: actionshub/chef-install@main
      - name: Release
        run: |
          COOKBOOK_NAME=$(grep "^name" metadata.rb | awk '{print $2}' | sed s/\'//g)
          COOKBOOK_VERSION=$(grep "^version" metadata.rb | awk '{print $2}' | sed s/\'//g)
          echo "NAME: ${COOKBOOK_NAME}"
          echo "VERSION: ${COOKBOOK_VERSION}"
          if ! git tag | grep -q v$COOKBOOK_VERSION; then
            echo "Cookbook version is already tagged, skipping job"
            exit 0
          fi
          if knife supermarket show $COOKBOOK_NAME $COOKBOOK_VERSION | grep -q $COOKBOOK_VERSION; then
            echo "Cookbook version already exists on supermarket, skipping job"
            exit 0
          fi
          git config --global user.email "<EMAIL>"
{'fraction_non_alphanumeric': 0.10414201183431952, 'fraction_numerical': 0.0067061143984220905, 'mean_word_length': 1.8361297539149888, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2064730', 'n_tokens_mistral': 1715, 'n_tokens_neox': 1611, 'n_words': 418}