Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto merge swipl-wasm bumps #1021

Open
jeswr opened this issue Apr 11, 2024 · 0 comments
Open

Auto merge swipl-wasm bumps #1021

jeswr opened this issue Apr 11, 2024 · 0 comments

Comments

@jeswr
Copy link
Member

jeswr commented Apr 11, 2024

Should look something like

name: Enable automerge on dependabot PRs

on:
  pull_request_target:

jobs:
  automerge:
    name: Enable automerge on dependabot PRs
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
      repository-projects: write
    if: github.actor == 'dependabot[bot]' && !contains(github.head_ref, 'dependabot/npm_and_yarn/swipl-wasm-')
    steps:
      - uses: actions/checkout@v4
      - run: gh pr merge ${{ github.event.pull_request.html_url }} --auto --squash
    env:
      GH_TOKEN: ${{ github.token }}
    if: github.actor == 'dependabot[bot]' && contains(github.head_ref, 'dependabot/npm_and_yarn/swipl-wasm-')
    steps:
      - uses: actions/checkout@v4
      - run: |
          PR_TITLE="${{ github.event.pull_request.title }}"
          before=$(echo $PR_TITLE | grep -oP '(?<=from )\d+\.\d+\.\d+')
          after=$(echo $PR_TITLE | grep -oP '(?<=to )\d+\.\d+\.\d+')
          
          readarray -d . -t before <<<"${before:2:-1}"
          readarray -d . -t after <<<"${current:2:-1}"

          if   [ ! ${before[0]} == ${after[0]} ]; then
            version="BREAKING CHANGE"
            branchHead="breaking"
          elif [ ! ${before[1]} == ${after[1]} ]; then
            version="feat"
            branchHead="feat"
          elif [ ! ${before[2]} == ${after[2]} ]; then
            version="fix"
            branchHead="fix"
          fi

          PR_TITLE="${PR_TITLE//build/$version}"

      - run: gh pr merge ${{ github.event.pull_request.html_url }} --auto --squash --body "$PR_TITLE"
    env:
      GH_TOKEN: ${{ github.token }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant