<commit_before>name: Create package bump PR

concurrency:
  group: create-package-bump-pr
  cancel-in-progress: true

on:
  push:
    branches:
      - 'master'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: git - configure commit user
        run: |
          git config user.name spinnakerbot
          git config user.email <EMAIL>

      - uses: actions/setup-node@v1
        name: node - setup
        with:
          node-version: ${{ env.NODE_VERSION  }}

      - name: yarn - get cache dir
        id: yarn-cache
        run: echo "::set-output name=dir::$(yarn cache dir)"

      - uses: actions/cache@v1
        with:
          path: ${{ steps.yarn-cache.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - name: yarn - Install Dependencies
        run: yarn --frozen-lockfile

      - name: lerna - Bump packages
        run: |
          npx lerna version --yes --no-push --conventional-commits
          # Fix the lerna commit message to also use conventional commits
          git commit --amend -m "$(git log -1 --pretty=%B | sed -e 's/^Publish/chore(publish): publish packages/')"

      - name: gha - get bumped packages
        id: bumps
        run: |
          scripts/gha_output_bumped_packages.sh
          scripts/gha_output_changelog.sh

      - name: Create Pull Request
        id: createpullrequest
        if: ${{ steps.bumps.outputs.bumps != '' }}
        uses: peter-evans/create-pull-request@v3
        with:
          # TODO: use a spinnakerbot Personal Access Token
          github-token: '${{ secrets.SPINNAKERBOT_TOKEN }}'
          commit-message: 'chore(package): Publish ${{ steps.bumps.outputs.bumps }}'
          title: 'Publish packages to NPM'
          body: |
            This PR will bump the version of any Deck package(s) that have pending changes.
            It bumps to the next semver version (patch/minor/major) depending on the pending commit messages according to [Conventional Commits](https://conventionalcommits.org) rules.
            It also updates dependency versions in other packages in the monorepo which depend on the bumped package(s).

            After this PR is merged, Github Actions will publish any bumped packages to the NPM registry.

            ${{ steps.bumps.outputs.changelog }}


            _Auto-generated by `.github/workflows/lerna-release-pr.yml`_

      - name: Approve package bump
        if: ${{ steps.bumps.outputs.bumps != '' }}
        # pin to v2.0.0 tag by commit hash
        uses: hmarr/auto-approve-action@7<PASSWORD>2<PASSWORD>
        with:
          github-token: '${{ secrets.SPINNAKERBOT_TOKEN }}'<commit_msg>fix(publishing): Pass pull request number to approve-pull-request action<commit_after>name: Create package bump PR

concurrency:
  group: create-package-bump-pr
  cancel-in-progress: true

on:
  push:
    branches:
      - 'master'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: git - configure commit user
        run: |
          git config user.name spinnakerbot
          git config user.email <EMAIL>

      - uses: actions/setup-node@v1
        name: node - setup
        with:
          node-version: ${{ env.NODE_VERSION  }}

      - name: yarn - get cache dir
        id: yarn-cache
        run: echo "::set-output name=dir::$(yarn cache dir)"

      - uses: actions/cache@v1
        with:
          path: ${{ steps.yarn-cache.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - name: yarn - Install Dependencies
        run: yarn --frozen-lockfile

      - name: lerna - Bump packages
        run: |
          npx lerna version --yes --no-push --conventional-commits
          # Fix the lerna commit message to also use conventional commits
          git commit --amend -m "$(git log -1 --pretty=%B | sed -e 's/^Publish/chore(publish): publish packages/')"

      - name: gha - get bumped packages
        id: bumps
        run: |
          scripts/gha_output_bumped_packages.sh
          scripts/gha_output_changelog.sh

      - name: Create Pull Request
        id: createpullrequest
        if: ${{ steps.bumps.outputs.bumps != '' }}
        uses: peter-evans/create-pull-request@v3
        with:
          # TODO: use a spinnakerbot Personal Access Token
          github-token: '${{ secrets.SPINNAKERBOT_TOKEN }}'
          commit-message: 'chore(package): Publish ${{ steps.bumps.outputs.bumps }}'
          title: 'Publish packages to NPM'
          body: |
            This PR will bump the version of any Deck package(s) that have pending changes.
            It bumps to the next semver version (patch/minor/major) depending on the pending commit messages according to [Conventional Commits](https://conventionalcommits.org) rules.
            It also updates dependency versions in other packages in the monorepo which depend on the bumped package(s).

            After this PR is merged, Github Actions will publish any bumped packages to the NPM registry.

            ${{ steps.bumps.outputs.changelog }}


            _Auto-generated by `.github/workflows/lerna-release-pr.yml`_

      - name: Approve package bump
        if: ${{ steps.createpullrequest.outputs.pull-request-number != '' }}
        # pin to v2.0.0 tag by commit hash
        uses: hmarr/auto-approve-action@7782c7e2bdf62b4d79bdcded8332808fd2f179cd
        with:
          github-token: '${{ secrets.SPINNAKERBOT_TOKEN }}'
          pull-request-number: ${{ steps.createpullrequest.outputs.pull-request-number }}
{'fraction_non_alphanumeric': 0.10880557977332171, 'fraction_numerical': 0.006974716652136007, 'mean_word_length': 2.1292962356792144, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1671611', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1688, 'n_words': 483}