<commit_before>name: repository
on:
  pull_request_target:
    types: [opened, reopened, synchronize, labeled, unlabeled]

jobs:
  check:
    name: Protection checks
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    timeout-minutes: 5
    env:
      HEAD_SHA: ${{ github.event.pull_request.head.sha }}
      BASE_SHA: ${{ github.event.pull_request.base.sha }}

    steps:
      - name: Clone target branch
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Fetch PR commits
        run: git fetch origin "${BASE_SHA}" "${HEAD_SHA}"

      - name: Clear .github-changes label
        if: ${{ !endsWith(github.event.action, 'labeled') }}
        uses: actions/github-script@v3
        with:
          script: |
            try {
              await github.issues.removeLabel({
                owner: context.repo.owner,
                repo: context.repo.repo,
                issue_number: context.issue.number,
                name: '.github-changes'
              });
            } catch (e) {
              if (e.name == 'HttpError' && e.status == 404) {
                /* expected: 404 if label is unset */
              } else {
                throw e;
              }
            }

      - name: Check for .github changes
        # We want to run this check any time the .github-changes label is not
        # set, which needs to include the case where we just unset it above.
        if: ${{ !endsWith(github.event.action, 'labeled') ||
                !contains(github.event.pull_request.labels.*.name, '.github-changes') }}
        run: |
          set -x
          git log --full-history --exit-code --patch "${HEAD_SHA}" --not "${BASE_SHA}" -- .github >&2

      - name: Check for node_modules availability and package.json consistency
        run: |
          # for each commit in the PR which modifies package.json or node_modules...
          for commit in $(git log --reverse --full-history --format=%H \
                              "${HEAD_SHA}" --not "${BASE_SHA}" -- package.json node_modules); do<commit_msg>.github: update github-script action to v6<commit_after>name: repository
on:
  pull_request_target:
    types: [opened, reopened, synchronize, labeled, unlabeled]

jobs:
  check:
    name: Protection checks
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    timeout-minutes: 5
    env:
      HEAD_SHA: ${{ github.event.pull_request.head.sha }}
      BASE_SHA: ${{ github.event.pull_request.base.sha }}

    steps:
      - name: Clone target branch
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Fetch PR commits
        run: git fetch origin "${BASE_SHA}" "${HEAD_SHA}"

      - name: Clear .github-changes label
        if: ${{ !endsWith(github.event.action, 'labeled') }}
        uses: actions/github-script@v6
        with:
          script: |
            try {
              await github.rest.issues.removeLabel({
                owner: context.repo.owner,
                repo: context.repo.repo,
                issue_number: context.issue.number,
                name: '.github-changes'
              });
            } catch (e) {
              if (e.name == 'HttpError' && e.status == 404) {
                /* expected: 404 if label is unset */
              } else {
                throw e;
              }
            }

      - name: Check for .github changes
        # We want to run this check any time the .github-changes label is not
        # set, which needs to include the case where we just unset it above.
        if: ${{ !endsWith(github.event.action, 'labeled') ||
                !contains(github.event.pull_request.labels.*.name, '.github-changes') }}
        run: |
          set -x
          git log --full-history --exit-code --patch "${HEAD_SHA}" --not "${BASE_SHA}" -- .github >&2

      - name: Check for node_modules availability and package.json consistency
        run: |
          # for each commit in the PR which modifies package.json or node_modules...
          for commit in $(git log --reverse --full-history --format=%H \
                              "${HEAD_SHA}" --not "${BASE_SHA}" -- package.json node_modules); do
{'fraction_non_alphanumeric': 0.11872360394181136, 'fraction_numerical': 0.005396527451900516, 'mean_word_length': 1.7239616613418531, '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': '5373183', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1161, 'n_words': 344}