<commit_before>name: Triage

on:
  pull_request_target:
    types:
      - opened
      - synchronize
      - reopened
      - closed
      - labeled
      - unlabeled
  schedule:
    - cron: "0 */3 * * *" # every 3 hours

jobs:
  review:
    runs-on: ubuntu-latest
    if: startsWith(github.repository, 'Homebrew/')
    steps:
      - name: Re-run this workflow
        if: github.event_name == 'schedule' || github.event.action == 'closed'
        uses: reitermarkus/rerun-workflow@64cba9e834916060e77b7dad424d086837fdd0a6
        with:
          token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
          continuous-label: waiting for feedback
          trigger-labels: critical
          workflow: triage.yml
      - name: Review pull request
        if: >
          (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') &&
            github.event.action != 'closed' && github.event.pull_request.state != 'closed'
        uses: actions/github-script@v4.0.1
        with:
          github-token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
          script: |
            async function approvePullRequest(pullRequestNumber) {
              const reviews = await approvalsByAuthenticatedUser(pullRequestNumber)

              if (reviews.length > 0) {
                return
              }

              await github.pulls.createReview({
                ...context.repo,
                pull_number: pullRequestNumber,
                event: 'APPROVE',
              })
            }

            async function findComment(pullRequestNumber, id) {
              const { data: comments } = await github.issues.listComments({
                owner: context.repo.owner,
                repo: context.repo.repo,
                issue_number: pullRequestNumber,
              })

              const regex = new RegExp(`<!--\\s*#${id}\\s*-->`)
              return comments.filter(comment => comment.body.match(regex))[0]
            }

            async function createOrUpdateComment(pullRequestNumber, id, message) {
              const beginComment = await findComment(pullRequestNumber, id)
<commit_msg>build(deps): bump actions/github-script from v4.0.1 to v4.0.2<commit_after>name: Triage

on:
  pull_request_target:
    types:
      - opened
      - synchronize
      - reopened
      - closed
      - labeled
      - unlabeled
  schedule:
    - cron: "0 */3 * * *" # every 3 hours

jobs:
  review:
    runs-on: ubuntu-latest
    if: startsWith(github.repository, 'Homebrew/')
    steps:
      - name: Re-run this workflow
        if: github.event_name == 'schedule' || github.event.action == 'closed'
        uses: reitermarkus/rerun-workflow@64cba9e834916060e77b7dad424d086837fdd0a6
        with:
          token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
          continuous-label: waiting for feedback
          trigger-labels: critical
          workflow: triage.yml
      - name: Review pull request
        if: >
          (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') &&
            github.event.action != 'closed' && github.event.pull_request.state != 'closed'
        uses: actions/github-script@v4.0.2
        with:
          github-token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
          script: |
            async function approvePullRequest(pullRequestNumber) {
              const reviews = await approvalsByAuthenticatedUser(pullRequestNumber)

              if (reviews.length > 0) {
                return
              }

              await github.pulls.createReview({
                ...context.repo,
                pull_number: pullRequestNumber,
                event: 'APPROVE',
              })
            }

            async function findComment(pullRequestNumber, id) {
              const { data: comments } = await github.issues.listComments({
                owner: context.repo.owner,
                repo: context.repo.repo,
                issue_number: pullRequestNumber,
              })

              const regex = new RegExp(`<!--\\s*#${id}\\s*-->`)
              return comments.filter(comment => comment.body.match(regex))[0]
            }

            async function createOrUpdateComment(pullRequestNumber, id, message) {
              const beginComment = await findComment(pullRequestNumber, id)

{'fraction_non_alphanumeric': 0.10409007352941177, 'fraction_numerical': 0.017003676470588234, 'mean_word_length': 1.8885202388852025, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6511362', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1210, 'n_words': 240}