Skip to content

EvolutionIQ/merge-conflict-action

 
 

Repository files navigation

merge-conflict-action

Github Action to notify merge conflict pulls

Usage

name: Notify merge conflict pulls

on:
  push:
    branches:
    - main

jobs:
  notify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: nokamoto/merge-conflict-action@v0.0.4
        with:
          owner: nokamoto
          repo: merge-conflict-action
          token: ${{ secrets.GITHUB_TOKEN }}
inputs description required default
owner A string identifier of the owner to retrieve merge conflict pulls. true
repo A string identifier of the repository to retrieve merge conflict pulls. true
token A string token to authenticate to Github. true
body A string body to create issue comments. false "Merge Conflict found"
dryrun A boolean to indicate whether the action creates actual issue comments. false "false"
ignore-label A string label name to filter pulls containing the specified label. false

How does it works?

sequenceDiagram
    autonumber

    actor dev as Developer
    participant github as Github
    participant action as merge-conflict-action

    dev ->> github : Merge pull
    github ->> action : on.push.branches.main (body, dryrun)
    action ->> github : pulls.list (state = open, sort = created, direction = desc, per_page = 30)
    github ->> action : pulls (number)

    loop for each pulls
        loop do while mergeable_state == "unknown"
            action ->> action : exponential backoff
            alt labels does not contain ignore-label
                action ->> action : drop
            end
            action ->> github : pulls.get
            github ->> action : pull (mergeable_state, pushed_at)
        end
        alt mergeable_state != "dirty"
            action ->> action : drop
        end
    end

    loop for each pulls
        action ->> github : issues.listComments
        github ->> action : comments (body', created_at)
        alt exists body == body' and created_at > pushed_at
            action ->> action : drop
        end
    end

    loop for each pulls
        alt dryrun == false
            action ->> github : isssues.createComment (body)
            github ->> dev : Notify merge conflict pulls <br> via issue comments subscription <br> (e.g. Slack /github subscribe)
        end
    end
Loading

Build

npm run all

Test, lint, format, and build dist/index.js.

Release

Manual. Use the Github release web interface with auto-generate release notes.

About

Github Action to notify merge conflict pulls

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 94.7%
  • Dockerfile 3.8%
  • JavaScript 1.5%