Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
80ef961
Run models through bedrock
sagar-thacker Jul 2, 2024
5decffd
Updated calls to both titan models
sagar-thacker Jul 2, 2024
954af7a
Added Scope3 Category1 notebook
sagar-thacker Jul 3, 2024
e9396c0
Update titan_bedrock.py
sagar-thacker Jul 3, 2024
c41ad7c
Updated readme and notebook instructions
sagar-thacker Jul 3, 2024
fdf4b8b
Removed instructions from readme and removed notebook for s3c1.
sagar-thacker Jul 3, 2024
cf80499
Merge pull request #1 from esg-flo/st/feature/bedrock
sagar-thacker Jul 3, 2024
683dceb
Initial project setup
sagar-thacker Oct 1, 2024
1c84747
Creating embedding with bedrock
sagar-thacker Oct 8, 2024
21df694
Removed redundant check
sagar-thacker Oct 8, 2024
b45bbd6
Updated embeddings file name and refactor
sagar-thacker Oct 10, 2024
4cf66c8
Added fn to load embeddings
sagar-thacker Oct 10, 2024
e112411
Added similarity search and entity relation match
sagar-thacker Oct 14, 2024
0b9986e
Added cluster computation & output generation
sagar-thacker Oct 15, 2024
f3b04a5
Create cocoon package and refactored imports, logging
sagar-thacker Oct 16, 2024
ad9d410
Removed redundant comments
sagar-thacker Oct 16, 2024
28187ac
Updated import in llm/bedrock
sagar-thacker Oct 16, 2024
c118bdd
Updated to run similarity search on all rows
sagar-thacker Oct 18, 2024
d1f4260
Send null instead of NaN in output
sagar-thacker Nov 12, 2024
feb790b
Save partial results & handle output format better
sagar-thacker Nov 18, 2024
15960f0
Updated the col name of db for output
sagar-thacker Nov 19, 2024
82d01da
Initial project setup
sagar-thacker Oct 1, 2024
4025dcd
Creating embedding with bedrock
sagar-thacker Oct 8, 2024
907eafa
Removed redundant check
sagar-thacker Oct 8, 2024
562df8f
Updated embeddings file name and refactor
sagar-thacker Oct 10, 2024
c3dc642
Added fn to load embeddings
sagar-thacker Oct 10, 2024
38b89a6
Added similarity search and entity relation match
sagar-thacker Oct 14, 2024
9ec5af6
Added cluster computation & output generation
sagar-thacker Oct 15, 2024
f7afd3f
Create cocoon package and refactored imports, logging
sagar-thacker Oct 16, 2024
e13857c
Updated to run similarity search on all rows
sagar-thacker Oct 18, 2024
e14de5f
Changed default values for output fields
sagar-thacker Mar 10, 2025
f64f14f
Creating embedding with bedrock
sagar-thacker Oct 8, 2024
53e1ebd
Removed redundant check
sagar-thacker Oct 8, 2024
edd5d14
Updated embeddings file name and refactor
sagar-thacker Oct 10, 2024
8689b13
Added fn to load embeddings
sagar-thacker Oct 10, 2024
d82c286
Added similarity search and entity relation match
sagar-thacker Oct 14, 2024
beca08c
Added cluster computation & output generation
sagar-thacker Oct 15, 2024
d669f0f
Create cocoon package and refactored imports, logging
sagar-thacker Oct 16, 2024
64ce1c7
Updated to run similarity search on all rows
sagar-thacker Oct 18, 2024
0a9cdc4
Creating embedding with bedrock
sagar-thacker Oct 8, 2024
9067d32
Removed redundant check
sagar-thacker Oct 8, 2024
dd2b4a0
Updated embeddings file name and refactor
sagar-thacker Oct 10, 2024
c612054
Added fn to load embeddings
sagar-thacker Oct 10, 2024
0a9ad78
Added similarity search and entity relation match
sagar-thacker Oct 14, 2024
160c1a6
Added cluster computation & output generation
sagar-thacker Oct 15, 2024
c1eceaf
Create cocoon package and refactored imports, logging
sagar-thacker Oct 16, 2024
d01808a
Updated to run similarity search on all rows
sagar-thacker Oct 18, 2024
739f431
Creating embedding with bedrock
sagar-thacker Oct 8, 2024
ea05670
Removed redundant check
sagar-thacker Oct 8, 2024
9ccf4f6
Updated embeddings file name and refactor
sagar-thacker Oct 10, 2024
50b4fcd
Added fn to load embeddings
sagar-thacker Oct 10, 2024
dacba54
Added similarity search and entity relation match
sagar-thacker Oct 14, 2024
1734cf2
Added cluster computation & output generation
sagar-thacker Oct 15, 2024
7a1809d
Create cocoon package and refactored imports, logging
sagar-thacker Oct 16, 2024
5e14a0d
Updated to run similarity search on all rows
sagar-thacker Oct 18, 2024
a5562e1
Added a validation to add index in search service
sagar-thacker Jun 5, 2025
1b9ae1b
[3017] Fixed security issues in cocoon
sagar-thacker Jun 18, 2025
463f93d
S3-210 Add core modules for database vectorization
sagar-thacker Aug 17, 2025
c2309b9
[S3-212] Integrate text cleaning in embedding creation
sagar-thacker Aug 18, 2025
b9b1dbb
S3-210 Add core modules for database vectorization
sagar-thacker Aug 17, 2025
d8fc18f
[S3-212] Integrate text cleaning in embedding creation
sagar-thacker Aug 18, 2025
eefa00d
S3-211 Add product interpretation service and prompt
sagar-thacker Aug 27, 2025
80ca128
S3-211 Refactor product data extraction with helper functions
sagar-thacker Sep 2, 2025
acd7643
S3-211 Add product interpretation service and prompt
sagar-thacker Aug 27, 2025
2f9ed7a
S3-211 Refactor product data extraction with helper functions
sagar-thacker Sep 2, 2025
0219f6f
EFN-3785-3786-3787 Upgraded packages to resolve security vulnerability
sagar-thacker Feb 26, 2026
caab96a
Merge branch 'release' into develop
sagar-thacker Feb 26, 2026
139a0ad
Merge pull request #39 from esg-flo/develop
sagar-thacker Feb 26, 2026
54b58a2
Merge pull request #40 from esg-flo/release
sagar-thacker Feb 26, 2026
d2b98be
Add auto-tagging release workflows (OPS-262)
Mar 28, 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
92 changes: 92 additions & 0 deletions .github/scripts/version_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/usr/bin/env python3
"""
Calculate semantic version based on commit message tags.
Supports [MAJOR], [MINOR], [FIX], and [PATCH] tags.
"""

import re
import sys
from typing import Tuple


def parse_version(version_string: str) -> Tuple[int, int, int]:
"""Parse a version string like 'v1.2.3' into (major, minor, patch)."""
version_string = version_string.lstrip("v")
parts = version_string.split(".")

major = int(parts[0]) if len(parts) > 0 else 0
minor = int(parts[1]) if len(parts) > 1 else 0
patch = int(parts[2]) if len(parts) > 2 else 0

return major, minor, patch


def determine_increment_type(commit_messages: str) -> str:
"""
Determine version increment type based on commit message tags.
Priority: MAJOR > MINOR > PATCH/FIX
"""
if re.search(r"\[MAJOR\]", commit_messages, re.IGNORECASE):
return "MAJOR"
elif re.search(r"\[MINOR\]", commit_messages, re.IGNORECASE):
return "MINOR"
elif re.search(r"\[(FIX|PATCH)\]", commit_messages, re.IGNORECASE):
return "PATCH"
else:
return "NONE"


def calculate_new_version(current_version: str, increment_type: str) -> str:
"""Calculate the new version based on increment type."""
major, minor, patch = parse_version(current_version)

if increment_type == "MAJOR":
return f"v{major + 1}.0.0"
elif increment_type == "MINOR":
return f"v{major}.{minor + 1}.0"
else: # PATCH or NONE (default to patch)
return f"v{major}.{minor}.{patch + 1}"


def has_version_tag(commit_messages: str) -> bool:
"""Check if any commit has a version increment tag."""
return bool(
re.search(r"\[(MAJOR|MINOR|FIX|PATCH)\]", commit_messages, re.IGNORECASE)
)


def main():
if len(sys.argv) < 3:
print(
"Usage: version_calculator.py <current_version> <commit_messages>",
file=sys.stderr,
)
sys.exit(1)

current_version = sys.argv[1]
commit_messages = sys.argv[2]

# Determine increment type
increment_type = determine_increment_type(commit_messages)

# If no tags found, default to PATCH
if increment_type == "NONE":
increment_type = "PATCH"
print("No increment designation found, defaulting to [FIX]")
else:
print(f"Found [{increment_type}] tag in commits")

# Calculate new version
new_version = calculate_new_version(current_version, increment_type)

# Check if we should add a note to release notes
needs_note = not has_version_tag(commit_messages)

# Output results
print(f"increment_type={increment_type}")
print(f"new_version={new_version}")
print(f"needs_note={'true' if needs_note else 'false'}")


if __name__ == "__main__":
main()
148 changes: 148 additions & 0 deletions .github/workflows/merge_main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Create Release from Commits

on:
push:
branches:
- main

env:
REPOSITORY_NAME: cocoon
AWS_REGION: eu-central-1

jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get commits since last release
id: get-commits
run: |
# Get the latest tag sorted by version, or use the first commit if none exists
LATEST_TAG=$(git tag --sort=-version:refname | head -n1 || git rev-list --max-parents=0 HEAD)

echo "Last release: $LATEST_TAG"
echo ""

# Get all commits since the last tag (or first commit)
# This includes commits from merged branches
COMMITS=$(git log --pretty=format:"- %s (%h)" ${LATEST_TAG}..HEAD)

# Get all commit messages for parsing (includes merged commits)
ALL_COMMIT_MESSAGES=$(git log --pretty=format:"%s" ${LATEST_TAG}..HEAD)

# Count the number of commits
COMMIT_COUNT=$(git log --oneline ${LATEST_TAG}..HEAD | wc -l)

echo "Found $COMMIT_COUNT commits since $LATEST_TAG"

# Exit early if no new commits
if [ "$COMMIT_COUNT" -eq 0 ]; then
echo "No new commits since last release. Skipping release creation."
echo "skip_release=true" >> $GITHUB_OUTPUT
exit 0
fi

echo ""
echo "Commits:"
echo "$COMMITS"

# Save for next step
echo "$ALL_COMMIT_MESSAGES" > commit_messages.txt
echo "$COMMITS" > formatted_commits.txt
echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
echo "skip_release=false" >> $GITHUB_OUTPUT

- name: Calculate version
if: steps.get-commits.outputs.skip_release != 'true'
id: version
run: |
# Get the latest tag sorted by version, or use v0.0.0 if none exists
LATEST_TAG=$(git tag --sort=-version:refname | head -n1)
if [ -z "$LATEST_TAG" ]; then
LATEST_TAG="v0.0.0"
fi
echo "Previous version: $LATEST_TAG"

# Read commit messages
COMMIT_MESSAGES=$(cat commit_messages.txt)

# Make script executable and run Python version calculator
chmod +x .github/scripts/version_calculator.py
OUTPUT=$(.github/scripts/version_calculator.py "$LATEST_TAG" "$COMMIT_MESSAGES")

# Parse output
INCREMENT_TYPE=$(echo "$OUTPUT" | grep "increment_type=" | cut -d= -f2)
NEW_VERSION=$(echo "$OUTPUT" | grep "new_version=" | cut -d= -f2)
NEEDS_NOTE=$(echo "$OUTPUT" | grep "needs_note=" | cut -d= -f2)

echo "New version: $NEW_VERSION"
echo "Increment type: $INCREMENT_TYPE"

# Output for next steps
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "needs_note=$NEEDS_NOTE" >> $GITHUB_OUTPUT

- name: Generate release notes
if: steps.get-commits.outputs.skip_release != 'true'
run: |
# Start release notes
cat > release_notes.md << 'EOF'
## Changes in this release

EOF

# Add note if no version tag was found
if [ "${{ steps.version.outputs.needs_note }}" = "true" ]; then
echo "**Note:** No incremental designation was assigned, defaulting to [FIX]" >> release_notes.md
echo "" >> release_notes.md
fi

# Add formatted commits
cat formatted_commits.txt >> release_notes.md

- name: Create GitHub Release
if: steps.get-commits.outputs.skip_release != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.version.outputs.version }} \
--title "Release ${{ steps.version.outputs.version }}" \
--notes-file release_notes.md

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: arn:aws:iam::285552316116:role/github_role
aws-region: ${{ env.AWS_REGION }}

- name: Publish to DynamoDB
if: steps.get-commits.outputs.skip_release != 'true'
run: |
# Generate UUID4 for the primary key
RELEASE_ID=$(uuidgen)

# Get current timestamp in ISO 8601 format
RELEASE_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

# Read release notes and escape for JSON
RELEASE_NOTES=$(cat release_notes.md | jq -Rs .)

# Create the DynamoDB item
aws dynamodb put-item \
--table-name release_notes \
--item "{
\"id\": {\"S\": \"$RELEASE_ID\"},
\"repository\": {\"S\": \"${{ env.REPOSITORY_NAME }}\"},
\"release_title\": {\"S\": \"Release ${{ steps.version.outputs.version }}\"},
\"release_notes\": {\"S\": $RELEASE_NOTES},
\"release_timestamp\": {\"S\": \"$RELEASE_TIMESTAMP\"},
\"recorded\": {\"BOOL\": false}
}"
Loading