<commit_before>name: CI

on:
  push:
    branches-ignore:
      - '_archived__**'
  pull_request_target:
    branches-ignore:
      - '_archived__**'
    paths-ignore:
      - '**/README.md'

jobs:
  pre_info:
    name: Initial Checks
    runs-on: ubuntu-latest
    outputs:
      skipCI: ${{ steps.checkci.outputs.result }}
      gitSHA: ${{ steps.checkci.outputs.gitSHA }}
    steps:
      - name: Run CI Check
        id: checkci
        env:
          GH_API: ${{ github.event.repository.commits_url }}
          GH_GH: ${{ toJson(github) }}
          GH_SHA: ${{ github.event.after }}
          PR_FIRSTSHA: ${{ github.event.pull_request.head.sha }}
          PR_NUM: ${{ github.event.pull_request.number }}
        run: |
          echo "Run ID    : $GITHUB_RUN_ID"
          echo "Event Name: $GITHUB_EVENT_NAME"
          echo "PR_NUM    : $PR_NUM"
          EXP_REF="ds\/(.*)$"
          if [[ $GITHUB_REF =~ $EXP_REF ]]; then
            GH_REF=${BASH_REMATCH[1]}
          fi
          REF=$([[ $GITHUB_HEAD_REF ]] && echo $GITHUB_HEAD_REF || echo $GH_REF)
          echo "HEAD_REF  : $GITHUB_HEAD_REF"
          echo "GITHUB_REF: $GITHUB_REF"
          echo "GH_REF    : $GH_REF"
          echo "Branch    : $REF"
          GH_SHA=$([[ $GH_SHA ]] && echo $GH_SHA || echo $PR_FIRSTSHA)
          echo "::set-output name=gitSHA::$GH_SHA"
          echo "Commit SHA: $GH_SHA"
          echo "PR Head SHA: $PR_FIRSTSHA"
          SKIP_A=$([[ "$REF" == l10n_* ]] && echo true || echo false)
          echo "Starts With l10n_ :  $SKIP_A"
          GH_API=${GH_API/'{/sha}'/}
          echo "API: $GH_API"
          CM=$(curl -s $GH_API/$GH_SHA | jq -r '.commit.message')
          echo "Commit Message: $CM"
          EXP_SKIP="\[ci skip]"
          SKIP_B=$([[ "$CM" =~ $EXP_SKIP ]] && echo true || echo false)
          echo "Skip via Commit: $SKIP_B"
          RES=$([[ $SKIP_A == true || $SKIP_B == true ]] && echo true || echo false)
          echo "Skip CI:  $RES"
          echo "::set-output name=result::$RES"
  all_jobs:
    name: Tests, Builds, Coverage
    runs-on: ubuntu-latest
    needs: pre_info
    if: needs.pre_info.outputs.skipCI == 'false'
    steps:
      - name: Checkout Commit
        uses: actions/checkout@v2
      - name: Use Node.js 14.x
        uses: actions/setup-node@v2.1.1
        with:
          node-version: '14.x'
      - name: Install dependencies (npm ci)
        run: npm ci
      - name: Run Tests
        run: npm run test -- --verbose
      - name: Run Lint
        run: npm run lint
      - name: Run Build
        run: npm run build
        env:
          GITSHA: ${{ needs.pre_info.outputs.gitSHA }}
      - name: Archive Code Coverage Results
        uses: actions/upload-artifact@v2
        with:
          name: coverage
          path: coverage
      - name: Codecov.io Coverage upload
        uses: codecov/codecov-action@v1
        with:
          fail_ci_if_error: false
          file: ./coverage/*
          token: ${{ secrets.CODECOV_TOKEN }} # Optional as it is open source repo
      - name: Codecov.io Alternative Coverage Upload
        if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
        env:<commit_msg>NPM CI Cache (#868)<commit_after>name: CI

on:
  push:
    branches-ignore:
      - "_archived__**"
  pull_request_target:
    branches-ignore:
      - "_archived__**"
    paths-ignore:
      - "**/README.md"

jobs:
  pre_info:
    name: Initial Checks
    runs-on: ubuntu-latest
    outputs:
      skipCI: ${{ steps.checkci.outputs.result }}
      gitSHA: ${{ steps.checkci.outputs.gitSHA }}
    steps:
      - name: Run CI Check
        id: checkci
        env:
          GH_API: ${{ github.event.repository.commits_url }}
          GH_GH: ${{ toJson(github) }}
          GH_SHA: ${{ github.event.after }}
          PR_FIRSTSHA: ${{ github.event.pull_request.head.sha }}
          PR_NUM: ${{ github.event.pull_request.number }}
        run: |
          echo "Run ID    : $GITHUB_RUN_ID"
          echo "Event Name: $GITHUB_EVENT_NAME"
          echo "PR_NUM    : $PR_NUM"
          EXP_REF="ds\/(.*)$"
          if [[ $GITHUB_REF =~ $EXP_REF ]]; then
            GH_REF=${BASH_REMATCH[1]}
          fi
          REF=$([[ $GITHUB_HEAD_REF ]] && echo $GITHUB_HEAD_REF || echo $GH_REF)
          echo "HEAD_REF  : $GITHUB_HEAD_REF"
          echo "GITHUB_REF: $GITHUB_REF"
          echo "GH_REF    : $GH_REF"
          echo "Branch    : $REF"
          GH_SHA=$([[ $GH_SHA ]] && echo $GH_SHA || echo $PR_FIRSTSHA)
          echo "::set-output name=gitSHA::$GH_SHA"
          echo "Commit SHA: $GH_SHA"
          echo "PR Head SHA: $PR_FIRSTSHA"
          SKIP_A=$([[ "$REF" == l10n_* ]] && echo true || echo false)
          echo "Starts With l10n_ :  $SKIP_A"
          GH_API=${GH_API/'{/sha}'/}
          echo "API: $GH_API"
          CM=$(curl -s $GH_API/$GH_SHA | jq -r '.commit.message')
          echo "Commit Message: $CM"
          EXP_SKIP="\[ci skip]"
          SKIP_B=$([[ "$CM" =~ $EXP_SKIP ]] && echo true || echo false)
          echo "Skip via Commit: $SKIP_B"
          RES=$([[ $SKIP_A == true || $SKIP_B == true ]] && echo true || echo false)
          echo "Skip CI:  $RES"
          echo "::set-output name=result::$RES"
  all_jobs:
    name: Tests, Builds, Coverage
    runs-on: ubuntu-latest
    needs: pre_info
    if: needs.pre_info.outputs.skipCI == 'false'
    steps:
      - name: Checkout Commit
        uses: actions/checkout@v2
      - name: Use Node.js 14.x
        uses: actions/setup-node@v2.1.1
        with:
          node-version: "14.x"
      - name: Get Node Version
        id: node
        run: |
          echo "Node Version:  $(node -v)"
          echo "::set-output name=version::$(node -v)"
      - name: Cache Node Modules
        id: nodeCache
        uses: actions/cache@v2
        with:
          # npm cache files stored in `~/.npm` on Linux
          path: ~/.npm
          key: ${{ runner.os }}-nodejs-${{ steps.node.outputs.version }}-npm-${{ hashFiles('**/package.json', '**/package-lock.json') }}
      - name: Install dependencies from cache (npm --cache-min install)
        if: steps.nodeCache.outputs.cache-hit == 'true'
        run: npm --cache-min 9999999 install
      - name: Install dependencies (npm ci)
        if: steps.nodeCache.outputs.cache-hit != 'true'
        run: npm ci
      - name: Run Tests
        run: npm run test -- --verbose
      - name: Run Lint
        run: npm run lint
      - name: Run Build
        run: npm run build
        env:
          GITSHA: ${{ needs.pre_info.outputs.gitSHA }}
      - name: Archive Code Coverage Results
        uses: actions/upload-artifact@v2
        with:
          name: coverage
          path: coverage
      - name: Codecov.io Coverage upload
        uses: codecov/codecov-action@v1
        with:
          fail_ci_if_error: false
          file: ./coverage/*
          token: ${{ secrets.CODECOV_TOKEN }} # Optional as it is open source repo
      - name: Codecov.io Alternative Coverage Upload
        if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
        env:
{'fraction_non_alphanumeric': 0.13795518207282914, 'fraction_numerical': 0.005742296918767507, 'mean_word_length': 1.901665989435189, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '3103277', 'n_tokens_mistral': 2503, 'n_tokens_neox': 2370, 'n_words': 573}