Skip to content

Commit

Permalink
Merge pull request #60 from Lombiq/issue/OSOE-144
Browse files Browse the repository at this point in the history
OSOE-144: Automatic comment on pull requests that have a merge conflict
  • Loading branch information
Piedone authored Oct 17, 2022
2 parents 8082227 + 97cc86b commit 25d3a28
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .github/actions/check-merge-conflict/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check For Merge Conflict
description: Checks for merge conflicts in in the current pull request.

runs:
using: "composite"
steps:
- name: Check for merge conflict
# releases/2.x
uses: eps1lon/actions-label-merge-conflict@b8bf8341285ec9a4567d4318ba474fee998a6919
with:
repoToken: ${{ env.GITHUB_TOKEN }}
commentOnDirty: "This pull request has merge conflicts. Please resolve those before requesting a review."
dirtyLabel: "Merge Conflict"
13 changes: 13 additions & 0 deletions .github/workflows/validate-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Validate Pull Request

on:
workflow_call:

jobs:
validate-pull-request:
runs-on: ubuntu-latest
steps:
- name: Check for Merge Conflict in PR
uses: Lombiq/GitHub-Actions/.github/actions/check-merge-conflict@issue/OSOE-144
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Verify Pull Request
name: Validate Pull Request
# This is the same workflow you'd find in our other submodules. Unlike the rest of the workflows in this repo, this one
# is meant to actually run here, so don't call it from other repos.
# is meant to actually run here, so don't call it from other repos.

on:
pull_request:

jobs:
call-verify-workflow:
uses: Lombiq/GitHub-Actions/.github/workflows/verify-submodule-pull-request.yml@dev

call-check-merge-conflict:
uses: Lombiq/GitHub-Actions/.github/workflows/validate-pull-request.yml@issue/OSOE-144
5 changes: 5 additions & 0 deletions .github/workflows/verify-submodule-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ jobs:
uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@dev
with:
title: ${{ github.event.pull_request.title }}

- name: Check for Merge Conflict in PR
uses: Lombiq/GitHub-Actions/.github/actions/check-merge-conflict@issue/OSOE-144
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions Docs/Actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ These actions can be invoked from a step in any other repository's workflow. The
In addition to the below short explanations, check out the inline documentation of the action you want to use, especially its parameters.

- `build-dotnet`: Builds all .NET solutions or projects in the given directory with optional static code analysis.
- `check-merge-conflict`: Labels and comments on pull requests with merge conflicts.
- `create-jira-issues-for-community-activities`: Creates Jira issues for community activities happening on GitHub, like issues, discussions, and pull requests being opened. Pull requests are only taken into account if they're not already related to a Jira issue (by starting their title with a Jira issue key).
- `enable-corepack`: Enables [Node corepack](https://nodejs.org/docs/latest-v16.x/api/corepack.html) so any package manager can be used seamlessly.
- `publish-nuget`: Publishes the content of the current directory as a NuGet package.
Expand Down
16 changes: 16 additions & 0 deletions Docs/Workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ jobs:
AZURE_APP_SERVICE_PUBLISH_PROFILE: ${{ secrets.AZURE_APP_SERVICE_PUBLISH_PROFILE }}
```

## Validate Pull Request

Labels and comments on Pull Requests with merge conflicts.

```yaml
name: Validate Pull Request
on:
push:
pull_request_target:
types: [synchronize]
jobs:
call-check-merge-conflict:
uses: Lombiq/GitHub-Actions/.github/workflows/validate-pull-request.yml@dev
```

## Jira issue creation for community activities workflow

Creates Jira issues for community activities happening on GitHub, like issues, discussions, and pull requests being opened. Pull requests are only taken into account if they're not already related to a Jira issue (by starting their title with a Jira issue key).
Expand Down

0 comments on commit 25d3a28

Please sign in to comment.