Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
36 changes: 36 additions & 0 deletions .github/workflows/create-issue-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Create branch from development on issue

on:
issues:
types: [opened]

permissions:
contents: write
issues: write

env:
SOURCE_BRANCH: development

jobs:
create-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.SOURCE_BRANCH }}
fetch-depth: 0

- name: Create and push branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
run: |
SLUG=$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/^-*//;s/-*$//' | cut -c1-40)
BRANCH="issue-${ISSUE_NUMBER}-${SLUG}"

git checkout ${{ env.SOURCE_BRANCH }}
git checkout -b "$BRANCH"
git push origin "$BRANCH"

gh issue comment "$ISSUE_NUMBER" --body "🔧 Branch \`$BRANCH\` created from \`${{ env.SOURCE_BRANCH }}\`."
17 changes: 17 additions & 0 deletions .github/workflows/enforce-pr-source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Enforce PR source branch

on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened, edited]

jobs:
check-source:
runs-on: ubuntu-latest
steps:
- name: Verify PR comes from development
if: github.head_ref != 'development'
run: |
echo "❌ PRs into master must come from the development branch."
echo "This PR is from: ${{ github.head_ref }}"
exit 1