Skip to content

PR-issue automation

PR-issue automation #1

Workflow file for this run

name: PR conflicts
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-conflicts:
runs-on: ubuntu-latest
steps:
- name: Check for merge conflicts
id: conflicts
uses: actions/github-script@v7
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
return pr.data.mergeable;
- name: Add label if conflicts exist
if: ${{ !steps.conflicts.outputs.result }}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['🚫 has conflicts']
});
- name: Remove label if no conflicts
if: ${{ steps.conflicts.outputs.result }}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: '🚫 has conflicts'
});