Skip to content

Commit

Permalink
feat: add workflow to verify conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: MatheusVict <[email protected]>
  • Loading branch information
MatheusVict committed Feb 21, 2024
1 parent b31894c commit 1dde397
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/verify_conflicts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Check for conflicts

on:
pull_request:
branches:
- main

jobs:
check-conflicts:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Check for conflicts
id: check
run: |
git fetch origin
git merge-base --is-ancestor HEAD FETCH_HEAD || echo "conflict=true" >> $GITHUB_ENV
- name: Add conflict tag
if: env.conflict == 'true'
uses: actions/github-script@v4
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'This pull request has conflicts. Please resolve them before merging.'
});
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['conflict']
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 1dde397

Please sign in to comment.