Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/external-pr-branch-enforcer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: External PR Branch Enforcer

on:
pull_request_target:
types: [opened, edited, synchronize]

jobs:
check-target-branch:
runs-on: ubuntu-latest
steps:
- name: Check PR target branch
if: github.event.pull_request.base.ref != 'develop' && (github.event.pull_request.author_association != 'OWNER' && github.event.pull_request.author_association != 'MEMBER')
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;

// Post comment on PR
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.name,
issue_number: pr.number,
body: '🤖 Attention! Always use the develop branch for your PRs instead of ' + pr.base.ref + '.'
});

// Change base branch to develop
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.name,
pull_number: pr.number,
base: 'develop'
});

// Add comment about the automatic change
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.name,
issue_number: pr.number,
body: '🤖 I\'ve automatically updated this PR to target the develop branch.'
});
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Welcome to BuildCLI - Java Project Management!
```

# Testing Workflow
# BuildCLI

**BuildCLI** is a command-line interface (CLI) tool for managing and automating common tasks in Java project development. It allows you to create, compile, manage dependencies, and run Java projects directly from the terminal, simplifying the development process.
Expand Down