Compare commits
8 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
485be3e57c | ||
|
|
30a5efb337 | ||
|
|
32a5b2be66 | ||
|
|
4cb019ef4a | ||
|
|
3ebfa2412e | ||
|
|
71b26ffaa4 | ||
|
|
ff53b020d9 | ||
|
|
c921fc1efb |
5 changed files with 63 additions and 22 deletions
47
.github/workflows/blank.yml
vendored
Normal file
47
.github/workflows/blank.yml
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
name: Gradle Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main, develop ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main, develop ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up JDK 21
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '21'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v3
|
||||||
|
|
||||||
|
- name: Make gradlew executable
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew build
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: ./gradlew test
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: build-artifacts
|
||||||
|
path: build/libs/
|
||||||
|
|
||||||
|
- name: Upload test results
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: test-results
|
||||||
|
path: build/reports/tests/
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Autoprefix-commit
|
# Autoprefix-commit
|
||||||
A simple intellij plugin that puts the current branch name in front of the commit message
|
A simple intellij plugin that puts the current branch name in front of the commit message
|
||||||
* Updates the branch every time the commit dialog is focussed
|
* Updates the branch every time the commit dialog is focussed
|
||||||
* Puts the branch name in front of any pre-existing text (unless the branch name was already there)
|
* Puts #[branchname] in front of any pre-existing text (unless the branch name was already there)
|
||||||
* No config for other fixed characters
|
* No config for other fixed characters
|
||||||
* Tested on IntelliJ 2025.x
|
* Tested on IntelliJ 2025.x
|
||||||
|
|
@ -5,7 +5,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.github.shautvast"
|
group = "com.github.shautvast"
|
||||||
version = "1.1"
|
version = "1.4"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
@ -20,8 +20,6 @@ dependencies {
|
||||||
testFramework(org.jetbrains.intellij.platform.gradle.TestFrameworkType.Platform)
|
testFramework(org.jetbrains.intellij.platform.gradle.TestFrameworkType.Platform)
|
||||||
bundledPlugin("Git4Idea")
|
bundledPlugin("Git4Idea")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
intellijPlatform {
|
intellijPlatform {
|
||||||
|
|
@ -31,7 +29,10 @@ intellijPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
changeNotes = """
|
changeNotes = """
|
||||||
Initial version: insert branchname in commit dialog. No configuration needed.
|
1.1 Initial version: insert branchname in commit dialog. No configuration needed.
|
||||||
|
1.2 No code changes. Plugin was mistakenly compiled using jdk22 so it didn't work.
|
||||||
|
1.3 minor fix for redundant space after the branch name
|
||||||
|
1.4 put # in front of the branch
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,25 +19,18 @@ class BranchNameCheckinHandlerFactory : CheckinHandlerFactory() {
|
||||||
(panel.preferredFocusedComponent)?.addFocusListener(object : FocusAdapter() {
|
(panel.preferredFocusedComponent)?.addFocusListener(object : FocusAdapter() {
|
||||||
override fun focusGained(e: FocusEvent?) {
|
override fun focusGained(e: FocusEvent?) {
|
||||||
// update commit message
|
// update commit message
|
||||||
val currentMessage = panel.commitMessage
|
val message = panel.commitMessage
|
||||||
val modifiedMessage = modifyCommitMessage(currentMessage)
|
val repository = GitRepositoryManager.getInstance(panel.project).repositories.firstOrNull()
|
||||||
panel.commitMessage = modifiedMessage
|
repository?.let {
|
||||||
|
it.currentBranchName?.let { b ->
|
||||||
|
if (!message.startsWith(b)) {
|
||||||
|
panel.commitMessage = "#$b $message"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun modifyCommitMessage(message: String): String {
|
|
||||||
val repository = GitRepositoryManager.getInstance(panel.project).repositories.firstOrNull()
|
|
||||||
|
|
||||||
return repository?.let {
|
|
||||||
val branchName = it.currentBranchName
|
|
||||||
if (branchName != null && !message.startsWith("${branchName} ")) {
|
|
||||||
"${it.currentBranchName ?: ""} ${message} "
|
|
||||||
} else {
|
|
||||||
message
|
|
||||||
}
|
|
||||||
} ?: message
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<idea-plugin>
|
<idea-plugin>
|
||||||
<id>com.github.shautvast.autoprefix-commit</id>
|
<id>nl.top-squad.autoprefix-commit</id>
|
||||||
|
|
||||||
<name>Autoprefix Commit Messages</name>
|
<name>Autoprefix Commit Messages</name>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue