<commit_before>name: Node.js CI

on:
  push:
    branches: [ '**' ]
  release:
    types: [ published ]
  pull_request:
    branches: [ '**' ]

jobs:
  build:
    env:
      NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || '' }}
      AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || '' }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      AWS_REGION: ${{ secrets.AWS_REGION }}
      SOURCE_DIR: 'dist'
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Use Node.js 12.x
      uses: actions/setup-node@v1
      with:
        node-version: 12
        registry-url: 'https://registry.npmjs.org'
    - name: Install npm
      run: npm install -g npm@7
    - name: Install Dependencies
      run: npm install

    # All the below are deploy-related steps
    - name: Extract Branch Name
      id: branch_name
      if: github.event_name == 'push'
      run: echo ::set-output name=BRANCH_NAME::${GITHUB_REF/refs\/heads\//}

    - name: Build for Distribution
      uses: GabrielBB/xvfb-action@v1.0
      with:
        run: npm run dist

    # Examples:
    # 1) PR feature/acme merged into dev
    # 2) branch A merged into branch B
    # 3) branch A pushed directly to git
    - name: Deploy Non-Tag Branches
      uses: jakejarvis/s3-sync-action@master
      if: github.event_name == 'push' && env.AWS_ACCESS_KEY_ID != ''
      with:
        args: --acl public-read --follow-symlinks --delete --cache-control "max-age=60"
      env:
        DEST_DIR: ${{ steps.branch_name.outputs.BRANCH_NAME }}

    # Release is published and deployed into s3://bucket-name/v5.2.2/
    - name: Deploy Released Branches
      uses: jakejarvis/s3-sync-action@master
      if: (github.event_name == 'release' && env.AWS_ACCESS_KEY_ID != ''
      with:
        args: --acl public-read --follow-symlinks --delete --cache-control "max-age=2592000"
      env:
        DEST_DIR: ${{ github.event.release.tag_name }}

    # Same release from previous deployed into s3://bucket-name/latest/
    - name: Deploy Latest Release
      uses: jakejarvis/s3-sync-action@master
      if: github.event_name == 'release' && github.event.release.prerelease == false && env.AWS_ACCESS_KEY_ID != ''
      with:
        args: --acl public-read --follow-symlinks --delete --cache-control "max-age=1209600"
      env:
        DEST_DIR: 'latest'
    
    # Publish to NPM
    - name: Publish Latest Release
      if: github.event_name == 'release' && github.event.release.prerelease == false && env.NODE_AUTH_TOKEN != ''
      run: npm run publish-ci

    # Publish to NPM with prerelease dist-tag
    - name: Publish Latest Prerelease
      if: github.event_name == 'release' && github.event.release.prerelease && env.NODE_AUTH_TOKEN != ''
      run: npm run publish-ci -- --dist-tag prerelease<commit_msg>Fix typo in workflow file<commit_after>name: Node.js CI

on:
  push:
    branches: [ '**' ]
  release:
    types: [ published ]
  pull_request:
    branches: [ '**' ]

jobs:
  build:
    env:
      NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || '' }}
      AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || '' }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      AWS_REGION: ${{ secrets.AWS_REGION }}
      SOURCE_DIR: 'dist'
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Use Node.js 12.x
      uses: actions/setup-node@v1
      with:
        node-version: 12
        registry-url: 'https://registry.npmjs.org'
    - name: Install npm
      run: npm install -g npm@7
    - name: Install Dependencies
      run: npm install

    # All the below are deploy-related steps
    - name: Extract Branch Name
      id: branch_name
      if: github.event_name == 'push'
      run: echo ::set-output name=BRANCH_NAME::${GITHUB_REF/refs\/heads\//}

    - name: Build for Distribution
      uses: GabrielBB/xvfb-action@v1.0
      with:
        run: npm run dist

    # Examples:
    # 1) PR feature/acme merged into dev
    # 2) branch A merged into branch B
    # 3) branch A pushed directly to git
    - name: Deploy Non-Tag Branches
      uses: jakejarvis/s3-sync-action@master
      if: github.event_name == 'push' && env.AWS_ACCESS_KEY_ID != ''
      with:
        args: --acl public-read --follow-symlinks --delete --cache-control "max-age=60"
      env:
        DEST_DIR: ${{ steps.branch_name.outputs.BRANCH_NAME }}

    # Release is published and deployed into s3://bucket-name/v5.2.2/
    - name: Deploy Released Branches
      uses: jakejarvis/s3-sync-action@master
      if: github.event_name == 'release' && env.AWS_ACCESS_KEY_ID != ''
      with:
        args: --acl public-read --follow-symlinks --delete --cache-control "max-age=2592000"
      env:
        DEST_DIR: ${{ github.event.release.tag_name }}

    # Same release from previous deployed into s3://bucket-name/latest/
    - name: Deploy Latest Release
      uses: jakejarvis/s3-sync-action@master
      if: github.event_name == 'release' && github.event.release.prerelease == false && env.AWS_ACCESS_KEY_ID != ''
      with:
        args: --acl public-read --follow-symlinks --delete --cache-control "max-age=1209600"
      env:
        DEST_DIR: 'latest'
    
    # Publish to NPM
    - name: Publish Latest Release
      if: github.event_name == 'release' && github.event.release.prerelease == false && env.NODE_AUTH_TOKEN != ''
      run: npm run publish-ci

    # Publish to NPM with prerelease dist-tag
    - name: Publish Latest Prerelease
      if: github.event_name == 'release' && github.event.release.prerelease && env.NODE_AUTH_TOKEN != ''
      run: npm run publish-ci -- --dist-tag prerelease
{'fraction_non_alphanumeric': 0.12826726674744676, 'fraction_numerical': 0.013155617102302232, 'mean_word_length': 2.5039417828987265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3598883', 'n_tokens_mistral': 2023, 'n_tokens_neox': 1934, 'n_words': 455}