Skip to content

Commit

Permalink
73 add workflow to create branch from issue (#74)
Browse files Browse the repository at this point in the history
* Add CIB template workflow

Signed-off-by: macinsight <[email protected]>

* Add PR Link in comment

Signed-off-by: macinsight <[email protected]>

* Add configuration file

Signed-off-by: macinsight <[email protected]>

* Update configuration for cib

Signed-off-by: macinsight <[email protected]>

* Add label skip for "invalid" and "wontfix" labels

Signed-off-by: macinsight <[email protected]>

* fix(ci): Add missing config to skip CI on PR creation

Signed-off-by: macinsight <[email protected]>

* feat(ci): Let PRs with label 'codebase' have branch 'yaml' as prtarget

Signed-off-by: macinsight <[email protected]>

---------

Signed-off-by: macinsight <[email protected]>
  • Loading branch information
macinsight authored Nov 28, 2023
1 parent cc202e7 commit 164790a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/issue-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
### Configuration file for ./workflows/create-branch-issue.yml
# Have branches be created when issue is assniged
mode: auto
# Use naming scheme of "issue-[id]"
branchName: short
# Auto-close an issue after the corresponding PR has been merged into `develop`
autoCloseIssue: true
branches:
# Prefix based on issue
- label: model
prefix: model/
- label: bug
prefix: bugfix/
# Skip based on label
- label: duplicate
skip: true
- label: help wanted
skip: true
- label: question
skip: true
- label: invalid
skip: true
- label: wontfix
skip: true
# Open PR to merge `develop` into `release` when issue has label "release"
- label: release
name: develop
prTarget: release
skipBranch: true
# Let PRs labelled "codebase" have branch "yaml" as prTarget and `develop` as source
- label: codebase
name: develop
prTarget: yaml
# Open a Draft PR on issue creation
openDraftPR: true
# Skip CI workflows on empty commits on PR creation (This "Feature" is a GH requirement)
prSkipCI: true
# Copy attributes from issue into PR
copyIssueDescriptionToPR: true
copyIssueLabelsToPR: true
copyIssueAssigneeToPR: true
copyIssueProjectsToPR: true
copyIssueMilestoneToPR: true
# Create "[Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/)" message (See [here](https://github.com/marketplace/actions/create-issue-branch#conventional-pull-request-titles))
conventionalPrTitles: true
# Use semantic versioning with gitmoji
conventionalStyle: semver
33 changes: 33 additions & 0 deletions .github/workflows/create-branch-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
# The issues event below is only needed for the default (auto) mode,
# you can remove it otherwise
issues:
types: [ assigned ]
# The issue_comment event below is only needed for the ChatOps mode,
# you can remove it otherwise
issue_comment:
types: [ created ]
pull_request:
types: [ closed ]

jobs:
create_issue_branch_job:
runs-on: ubuntu-latest
steps:
- name: Create Issue Branch
uses: robvanderleek/create-issue-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: add pr link in comment
uses: mshick/add-pr-comment@master
if: steps.create-issue-branch.outputs.branchName != ''
env:
PULL_REQUEST_URL: ${{ format('https://github.com/{0}/compare/{1}...{2}?quick_pull=1&template={3}', github.repository, github.event.repository.default_branch, steps.create-issue-branch.outputs.branchName, steps.template.outputs.template-name) }}
TEMPLATE: ${{ steps.template.outputs.template-name }}
with:
message: |
## Pull Request ![](https://raw.githubusercontent.com/primer/octicons/master/icons/git-pull-request-16.svg)
[Create a pull request](${{ env.PULL_REQUEST_URL }}) for the issue branch using the `${{ env.TEMPLATE }}` template.
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: "github-actions[bot]"

0 comments on commit 164790a

Please sign in to comment.