0

There is a GitHub repo created by the startup company Olivr that allows a free subdomain to be used. The check script is:

name: Automerge PR
on:
  pull_request_target:
    paths:
      - "zones/*.yaml"

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout PR
        uses: actions/checkout@v2
        with:
          ref: ${{github.event.pull_request.head.ref}}
          repository: ${{github.event.pull_request.head.repo.full_name}}
          fetch-depth: 0

      - name: Fetch main repo
        run: |
          git remote add upstream https://github.com/Olivr/free-domain.git
          git fetch upstream
      - name: Make sure there's only one TLD affected
        run: |
          TLD_FILE=$(git diff --name-only upstream/main)
          [[ $TLD_FILE == zones/cluster.ws.yaml ]] || [[ $TLD_FILE == zones/wip.la.yaml ]]
      - name: Make sure that only one line was affected
        run: |
          TLD_FILE=$(git diff --name-only upstream/main)
          DIFF_LOG=$(diff <(git show upstream/main:$TLD_FILE) $TLD_FILE | grep ^[[:digit:]])
          [[ $(echo $DIFF_LOG | wc -l) == 1 ]]
          [[ $DIFF_LOG =~ ^[0-9]+a[0-9]+$ ]]
      - name: Make sure zone file is valid
        run: |
          TLD_FILE=$(git diff --name-only upstream/main)
          npx ajv-cli validate -s dns.schema.json -d $TLD_FILE
      # - name: If a domain was modified, make sure it is done by the owner
      #   run: |
      #     TLD_FILE=$(git diff --name-only upstream/main)
      #     DIFF_LOG=$(diff <(git show upstream/main:$TLD_FILE) $TLD_FILE | grep ^[[:digit:]])
      #     CHANGED_LINES=${DIFF_LOG#[0-9]*c},${DIFF_LOG#[0-9]*c}
      #     [[ ${DIFF_LOG#[0-9]*a} == $(expr ${DIFF_LOG%a[0-9]*} + 1) ]] || [[ $(git blame -te -L$CHANGED_LINES upstream/main -- $TLD_FILE | awk '{print substr($2,2)}') == $(git blame --line-porcelain -L$CHANGED_LINES -- $TLD_FILE | grep -E '^(committer-mail)' | awk '{print $2}') ]]

      - name: Auto-merge
        uses: "pascalgn/automerge-action@v0.14.2"
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          MERGE_METHOD: "squash"
          MERGE_COMMIT_MESSAGE: "pull-request-title"
          MERGE_DELETE_BRANCH: true
          UPDATE_METHOD: "rebase"
          MERGE_LABELS: ""

The check for one line fails every time, even if only one line was changed. I've already emailed without a response.

I tried a few things, but they do not work.

NotM1zzel
  • 1
  • 1

0 Answers0