github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/.github/workflows/fix-conflicts.yml (about)

     1  name: Solve conflicts
     2  
     3  on: workflow_dispatch
     4  # TODO: when we confirm this works well we should uncomment this
     5  # on:
     6  #   pull_request:
     7  #     types:
     8  #       - synchronize
     9  #       - labeled
    10  
    11  jobs:
    12    fix-conflicts:
    13      runs-on: ubuntu-latest
    14      steps:
    15        - name: Checkout
    16          uses: actions/checkout@v2
    17        - uses: actions/setup-go@v2
    18          with:
    19            go-version: '^1.19.0'
    20        - name: Resolves merge conflicts
    21          if: github.event.label.name == "has conflicts"
    22          run: |
    23            git config user.name "Pyroscope Bot"
    24            git config user.email "dmitry+bot@pyroscope.io"
    25            files=(`git diff --name-only --diff-filter=U -- yarn.lock go.sum`)
    26            if [ ${#files[@]} -ge 1 ];then
    27              git checkout origin/main -- "$files"
    28              if echo $files | grep -o yarn.lock &> /dev/null; then
    29                yarn
    30              fi
    31              if echo $files | grep -o go.sum &> /dev/null; then
    32                go mod tidy
    33              fi
    34              git add "$files"
    35              git commit -m "resolves merge conflict"
    36              git push
    37            fi