<commit_before>name: Pull Request Checks

on: [pull_request]

jobs:
  build_image:
    name: Build Image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Make GITHUB_ACCESS_TOKEN available
        run: echo $DOCKER_GITHUB_ACCESS_TOKEN > GITHUB_ACCESS_TOKEN
        env:
          DOCKER_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Docker Build
        run: DOCKER_BUILDKIT=1 docker build . -t docker.pkg.github.com/josephduffy/josephduffy.co.uk/website:$GITHUB_SHA --secret=id=GITHUB_ACCESS_TOKEN,src=./GITHUB_ACCESS_TOKEN

  check_format:
    name: Check for formatting errors using on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2

      - name: Read .node-version
        run: echo "##[set-output name=node-version;]$(cat .node-version)"
        id: node-version

      - name: Install node
        uses: actions/setup-node@v2
        with:
          node-version: "${{ steps.node-version.outputs.node-version }}"

      - run: npm install
      - run: npm run format:check

  lint:
    name: Check for linting errors using on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2

      - name: Read .node-version
        run: echo "##[set-output name=node-version;]$(cat .node-version)"
        id: node-version

      - name: Install node
        uses: actions/setup-node@v2
        with:
          node-version: "${{ steps.node-version.outputs.node-version }}"

      - run: npm install
      - run: npm run lint<commit_msg>Comment on PRs with linting issues<commit_after>name: Pull Request Checks

on: [pull_request]

jobs:
  build_image:
    name: Build Image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Make GITHUB_ACCESS_TOKEN available
        run: echo $DOCKER_GITHUB_ACCESS_TOKEN > GITHUB_ACCESS_TOKEN
        env:
          DOCKER_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Docker Build
        run: DOCKER_BUILDKIT=1 docker build . -t docker.pkg.github.com/josephduffy/josephduffy.co.uk/website:$GITHUB_SHA --secret=id=GITHUB_ACCESS_TOKEN,src=./GITHUB_ACCESS_TOKEN

  check_format:
    name: Check for formatting errors using on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2

      - name: Read .node-version
        run: echo "##[set-output name=node-version;]$(cat .node-version)"
        id: node-version

      - name: Install node
        uses: actions/setup-node@v2
        with:
          node-version: "${{ steps.node-version.outputs.node-version }}"

      - run: npm install
      - run: npm run format:check

  lint:
    name: Check for linting errors using on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2

      - name: Read .node-version
        run: echo "##[set-output name=node-version;]$(cat .node-version)"
        id: node-version

      - name: Install node
        uses: actions/setup-node@v2
        with:
          node-version: "${{ steps.node-version.outputs.node-version }}"

      - run: npm install

      - run: npm run lint -- --output-file eslint_report.json --format json
        continue-on-error: true

      - name: Annotate Code Linting Results
        uses: ataylorme/eslint-annotate-action@1.2.0
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          report-json: "eslint_report.json"
      - name: Upload ESLint report
        uses: actions/upload-artifact@v2
        with:
          name: eslint_report.json
          path: eslint_report.json
{'fraction_non_alphanumeric': 0.11830473218928757, 'fraction_numerical': 0.004160166406656267, 'mean_word_length': 2.2629346904156065, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2097522', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1266, 'n_words': 279}