<commit_before># The outline of this workflow is something that the GitHub Security team warns against
# here: https://securitylab.github.com/research/github-actions-preventing-pwn-requests. But
# due to this workflow only running a git diff check and not building or publishing anything,
# there is no harm in checking out the PR HEAD code.
#
# All the code checked out in this workflow should be considered untrusted. This workflow must 
# never call any makefiles or scripts. It must never be changed to run any code from the checkout.
on:
  pull_request_target:
    # Runs on PRs to master and all release branches
    # By default it triggers on opened, synchronize, or reopened PRs
    branches:
      - master
      - release/*

jobs:
  changelog-check:
    # If there  a `pr/no-changelog` label we ignore this check
    if: "!${{ contains(github.event.pull_request.label.*.name, 'pr/no-changelog')}}"
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
      - name: Check for changelog entry in diff
        run: |
          # check if there is a diff in the .changelog directory
          changelog_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "${{ github.event.pull_request.base.ref }}")" -- .changelog/)

          # If we do not find a file in .changelog/, we post a comment to the PR
          if [ -z "$changelog_files" ]; then
            # post PR comment to GitHub when no .changelog entry was found on PR
            echo "changelog-check: Did not find a .changelog entry, posting a reminder in the PR"
            github_message="🤔 Double check that this PR does not require a changelog entry in the .changelog directory. [Reference](https://github.com/hashicorp/consul/pull/8387)"
            curl -f -s -H "Authorization: token ${{ secrets.PR_COMMENT_TOKEN }}" \
                -X POST \
                -d "{ \"body\": \"${github_message}\"}" \
                "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments"<commit_msg>ci: fix changelog check checkout (#9688)<commit_after># The outline of this workflow is something that the GitHub Security team warns against
# here: https://securitylab.github.com/research/github-actions-preventing-pwn-requests. But
# due to this workflow only running a git diff check and not building or publishing anything,
# there is no harm in checking out the PR HEAD code.
#
# All the code checked out in this workflow should be considered untrusted. This workflow must
# never call any makefiles or scripts. It must never be changed to run any code from the checkout.
on:
  pull_request_target:
    # Runs on PRs to master and all release branches
    # By default it triggers on opened, synchronize, or reopened PRs
    branches:
      - master
      - release/*

jobs:
  changelog-check:
    # If there  a `pr/no-changelog` label we ignore this check
    if: "!${{ contains(github.event.pull_request.label.*.name, 'pr/no-changelog')}}"
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0 # by default the checkout action doesn't checkout all branches
      - name: Check for changelog entry in diff
        run: |
          # check if there is a diff in the .changelog directory
          changelog_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "${{ github.event.pull_request.base.ref }}")" -- .changelog/)

          # If we do not find a file in .changelog/, we post a comment to the PR
          if [ -z "$changelog_files" ]; then
            # post PR comment to GitHub when no .changelog entry was found on PR
            echo "changelog-check: Did not find a .changelog entry, posting a reminder in the PR"
            github_message="🤔 Double check that this PR does not require a changelog entry in the .changelog directory. [Reference](https://github.com/hashicorp/consul/pull/8387)"
            curl -f -s -H "Authorization: token ${{ secrets.PR_COMMENT_TOKEN }}" \
                -X POST \
                -d "{ \"body\": \"${github_message}\"}" \
                "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments"
{'fraction_non_alphanumeric': 0.10202205882352941, 'fraction_numerical': 0.003446691176470588, 'mean_word_length': 2.682741116751269, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, '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': '4537709', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1241, 'n_words': 477}