Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
92935da
Remove Maven prerequisites from pom.xml
Nandishn969 Jan 10, 2026
ea6991e
Update manual workflow to create branches in repos
Nandishn969 Feb 9, 2026
bcc0045
Refactor manual workflow to use hardcoded repos
Nandishn969 Feb 10, 2026
c7f9a25
Add GitHub Actions workflow to create branches
Nandishn969 Feb 10, 2026
23f48c0
Add workflow to create branches in multiple repos
Nandishn969 Feb 10, 2026
4e9a12f
Update organization name in manual.yml
Nandishn969 Feb 10, 2026
03cef9d
Change default branch from 'main' to 'master'
Nandishn969 Feb 10, 2026
8aee491
Change default branch from 'master' to 'main'
Nandishn969 Feb 10, 2026
ffff0b7
Remove 'New Actions' repository from workflow
Nandishn969 Feb 10, 2026
753091a
Refactor manual workflow to remove base_branch input
Nandishn969 Feb 10, 2026
370a05d
Update repository name in manual workflow
Nandishn969 Feb 10, 2026
479d905
Update GH_TOKEN in manual.yml
Nandishn969 Feb 10, 2026
f19ce1d
Replace hardcoded GH_TOKEN with secret reference
Nandishn969 Feb 10, 2026
b7b4e7d
Add 'New-Actions' repo to manual workflow
Nandishn969 Feb 10, 2026
eb84e61
Update GH_TOKEN in manual.yml
Nandishn969 Feb 10, 2026
31523de
Change GH_TOKEN in manual.yml
Nandishn969 Feb 17, 2026
bd7953c
Add commit message validation workflow
Nandishn969 Jun 5, 2026
8d4cbf7
kjeewf
Jun 8, 2026
15ae958
Merge branch 'main' of https://github.com/Nandishn969/hello-world int…
Jun 8, 2026
d611245
kjeewf
Jun 8, 2026
2ecb914
ABC-123
Jun 8, 2026
18caf8c
ABC-123
Jun 8, 2026
6067c65
not providing any jira key
Jun 8, 2026
ad7fdcc
ABC-123
Jun 8, 2026
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
74 changes: 74 additions & 0 deletions .github/workflows/commit-message-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Commit Message Check

on:
push:
branches:
- 'feature/**'
- 'bugfix/**'
pull_request:
branches:
- main
- develop

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Validate commits
run: |
BRANCH="$GITHUB_REF_NAME"
BRANCH_KEY=$(echo "$BRANCH" | grep -oE '[A-Z]+-[0-9]+' | head -1)
BEFORE="${{ github.event.before }}"
AFTER="${{ github.event.after }}"

echo "Branch: $BRANCH"
echo "Branch Key: $BRANCH_KEY"
echo ""

if [ -z "$BRANCH_KEY" ]; then
echo "✅ No Jira key in branch name. Skipping."
exit 0
fi

# Get commits (push event)
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
COMMITS=$(git log --format="%H|%s" "$AFTER" -10)
elif [ -n "$BEFORE" ] && [ -n "$AFTER" ]; then
COMMITS=$(git log --format="%H|%s" "$BEFORE..$AFTER")
else
# Pull request — check all commits in PR
COMMITS=$(git log --format="%H|%s" "origin/${{ github.base_ref }}..HEAD")
fi

FAIL=0
while IFS= read -r line; do
[ -z "$line" ] && continue
SHA=$(echo "$line" | cut -d'|' -f1 | cut -c1-7)
MSG=$(echo "$line" | cut -d'|' -f2-)
KEY=$(echo "$MSG" | grep -oE '[A-Z]+-[0-9]+' | head -1)

if [ -z "$KEY" ]; then
echo "❌ [$SHA] Missing Jira key → \"$MSG\""
FAIL=1
continue
fi

if echo "$BRANCH" | grep -q "^bugfix/" && [ "$KEY" != "$BRANCH_KEY" ]; then
echo "❌ [$SHA] Key $KEY ≠ branch key $BRANCH_KEY → \"$MSG\""
FAIL=1
continue
fi

echo "✅ [$SHA] $MSG"
done <<< "$COMMITS"

echo ""
if [ "$FAIL" -eq 1 ]; then
echo "❌ FAILED"
exit 1
fi
echo "✅ ALL COMMITS VALID"
56 changes: 56 additions & 0 deletions .github/workflows/create-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Create branches in multiple repos

on:
workflow_dispatch:
inputs:
jira_key:
description: "Jira issue key (e.g. ABC-123)"
required: true
base_branch:
description: "Base branch name"
required: false
default: "main"

jobs:
create-branches:
runs-on: ubuntu-latest

steps:
- name: Create branches in repos
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
JIRA_KEY: ${{ github.event.inputs.jira_key }}
BASE_BRANCH: ${{ github.event.inputs.base_branch }}
run: |
set -e

ORG="<YOUR_ORG_NAME>"
BRANCH_NAME="feature/${JIRA_KEY}"

REPOS=(
"hello-world"
"New Actions"
)

for REPO in "${REPOS[@]}"; do
echo "Creating branch in $ORG/$REPO"

BASE_SHA=$(curl -s \
-H "Authorization: token $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$ORG/$REPO/git/ref/heads/$BASE_BRANCH" \
| jq -r .object.sha)

if [ "$BASE_SHA" = "null" ]; then
echo "Base branch '$BASE_BRANCH' not found in $REPO"
continue
fi

curl -s -X POST \
-H "Authorization: token $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$ORG/$REPO/git/refs" \
-d "{\"ref\":\"refs/heads/$BRANCH_NAME\",\"sha\":\"$BASE_SHA\"}"

echo "Branch $BRANCH_NAME created in $REPO"
done
75 changes: 75 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Create branches in multiple repos

on:
workflow_dispatch:
inputs:
jira_key:
description: "Jira issue key (e.g. ABC-123)"
required: true

jobs:
create-branches:
runs-on: ubuntu-latest

steps:
- name: Create branches in repos
env:
GH_TOKEN: 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
JIRA_KEY: ${{ github.event.inputs.jira_key }}
run: |
set -e

ORG="Nandishn969"
BRANCH_NAME="feature/${JIRA_KEY}"

REPOS=(
"hello-world"
"New-Actions"
"Jira-Cloud"
)

for REPO in "${REPOS[@]}"; do
echo "--------------------------------------"
echo "Processing repo: $ORG/$REPO"

# 1️⃣ Get default branch
DEFAULT_BRANCH=$(curl -s \
-H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/$ORG/$REPO \
| jq -r .default_branch)

if [ "$DEFAULT_BRANCH" = "null" ] || [ -z "$DEFAULT_BRANCH" ]; then
echo "❌ Could not determine default branch for $REPO"
continue
fi

echo "Default branch is: $DEFAULT_BRANCH"

# 2️⃣ Get SHA of default branch
BASE_SHA=$(curl -s \
-H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/$ORG/$REPO/git/ref/heads/$DEFAULT_BRANCH \
| jq -r .object.sha)

if [ "$BASE_SHA" = "null" ] || [ -z "$BASE_SHA" ]; then
echo "❌ Failed to fetch SHA for $DEFAULT_BRANCH in $REPO"
continue
fi

# 3️⃣ Create branch
CREATE_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/$ORG/$REPO/git/refs \
-d "{\"ref\":\"refs/heads/$BRANCH_NAME\",\"sha\":\"$BASE_SHA\"}")

if [ "$CREATE_RESPONSE" = "201" ]; then
echo "✅ Branch $BRANCH_NAME created in $REPO"
elif [ "$CREATE_RESPONSE" = "422" ]; then
echo "⚠️ Branch $BRANCH_NAME already exists in $REPO"
else
echo "❌ Failed to create branch in $REPO (HTTP $CREATE_RESPONSE)"
fi
done
56 changes: 56 additions & 0 deletions actions/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Create branches in multiple repos

on:
workflow_dispatch:
inputs:
jira_key:
description: "Jira issue key (e.g. ABC-123)"
required: true
base_branch:
description: "Base branch name"
required: false
default: "main"

jobs:
create-branches:
runs-on: ubuntu-latest

steps:
- name: Create branches in repos
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
JIRA_KEY: ${{ github.event.inputs.jira_key }}
BASE_BRANCH: ${{ github.event.inputs.base_branch }}
run: |
set -e

ORG="<YOUR_ORG_NAME>"
BRANCH_NAME="feature/${JIRA_KEY}"

REPOS=(
"hello-world"
"New Actions"
)

for REPO in "${REPOS[@]}"; do
echo "Creating branch in $ORG/$REPO"

BASE_SHA=$(curl -s \
-H "Authorization: token $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$ORG/$REPO/git/ref/heads/$BASE_BRANCH" \
| jq -r .object.sha)

if [ "$BASE_SHA" = "null" ]; then
echo "Base branch '$BASE_BRANCH' not found in $REPO"
continue
fi

curl -s -X POST \
-H "Authorization: token $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$ORG/$REPO/git/refs" \
-d "{\"ref\":\"refs/heads/$BRANCH_NAME\",\"sha\":\"$BASE_SHA\"}"

echo "Branch $BRANCH_NAME created in $REPO"
done
4 changes: 0 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,4 @@
<url>http://github.com/jleetutorial/maven-project</url>
</scm>

<prerequisites>
<maven>3.0.3</maven>
</prerequisites>

</project>
1 change: 1 addition & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kujhfked
1 change: 1 addition & 0 deletions testing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Testing githiub validations
2 changes: 2 additions & 0 deletions text.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hikujhedoed
dwdh
1 change: 1 addition & 0 deletions text1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
heinfdkjdh