Skip to content

Conversation

@uju09
Copy link
Contributor

@uju09 uju09 commented Nov 13, 2025

Description

This PR fixes the broken release job of Build and Deploy workflow.

Fixes #539

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

Summary by CodeRabbit

  • Chores
    • Improved build workflow with enhanced disk usage visibility and cleanup to support more reliable Android builds.
    • Enabled CHANGELOG-driven release metadata so build tags and release notes are populated automatically.
    • Optimized APK artifact handling and deployment flow for more consistent releases.

✏️ Tip: You can customize this high-level summary in your review settings.

M4dhav and others added 4 commits November 14, 2025 00:01
Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
@coderabbitai
Copy link

coderabbitai bot commented Nov 13, 2025

📝 Walkthrough

Walkthrough

Added disk-usage checks and cleanup steps to the GitHub Actions workflow, wired CHANGELOG.md parsing to expose build_tag and release_notes, introduced APK_RELEASE_PATH for artifact flow, re-added checkout in deploy job, and updated deploy steps to use the new artifact path and release metadata.

Changes

Cohort / File(s) Change Summary
CI workflow (primary)
​.github/workflows/build_and_deploy.yml
Added disk usage before/after cleanup, integrated free-disk-space step, expanded cleanup (Flutter/Gradle cache removal), re-added checkout in deploy job, introduced APK_RELEASE_PATH env var, and switched deploy steps to use APK_RELEASE_PATH for artifact download/upload and release.
Release metadata
​.github/workflows/build_and_deploy.yml
Added parsing of CHANGELOG.md to produce build_tag and release_notes outputs and wired those into the release action (tag and body).
Artifact handling
​.github/workflows/build_and_deploy.yml
Adjusted artifact download/upload paths to align with APK_RELEASE_PATH and ensured MIME/content type set for Android package releases.

Sequence Diagram(s)

mermaid
sequenceDiagram
autonumber
participant Dev as Developer (push/PR)
participant GH as GitHub Actions
participant Runner as Runner (VM)
participant Cache as Gradle/Flutter Cache
participant Artifacts as Artifact storage
participant Release as GitHub Release
Note over GH,Runner: Build job start
Dev->>GH: push event triggers workflow
GH->>Runner: checkout repo
Runner->>Runner: show disk usage (before)
Runner->>Cache: run cleanup (flutter clean, rm build/cache)
Runner->>Runner: free-disk-space check
Runner->>Runner: show disk usage (after)
Runner->>Runner: build APK -> save to APK_RELEASE_PATH
Runner->>Artifacts: upload artifact at APK_RELEASE_PATH
Note over GH,Runner: Deploy job start
GH->>Runner: checkout repo (deploy)
Runner->>Artifacts: download artifact from APK_RELEASE_PATH
Runner->>Runner: parse CHANGELOG.md -> outputs build_tag, release_notes
Runner->>Release: create/update release using build_tag and release_notes, attach APK

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped through logs and cleared the heap,

Cleaned builds and caches, no disk too deep.
Tags from changelogs, APKs in their place,
A tiny hop, a tidy trace—
CI sings, and I nibble a carrot of grace. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: The release of APK is fixed' is related to the PR's main objective of fixing the broken release job, but uses awkward phrasing ('fixed' appears twice) and lacks specificity about what was actually fixed in the workflow.
Linked Issues check ✅ Passed The PR successfully addresses issue #539 by restoring the Build and Deploy workflow through disk cleanup, APK artifact flow fixes, CHANGELOG-driven release metadata parsing, and deploy step enhancements as required.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the Build and Deploy workflow per issue #539, including cleanup steps, disk space management, artifact handling, and release metadata extraction from CHANGELOG.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

🎉 Welcome @uju09!
Thank you for your pull request! Our team will review it soon. 🔍

  • Please ensure your PR follows the contribution guidelines. ✅
  • All automated tests should pass before merging. 🔄
  • If this PR fixes an issue, link it in the description. 🔗

We appreciate your contribution! 🚀

@uju09
Copy link
Contributor Author

uju09 commented Nov 13, 2025

@M4dhav I request you to review.

@M4dhav M4dhav self-requested a review November 14, 2025 07:39
@M4dhav M4dhav added the bug Something isn't working label Nov 14, 2025
@M4dhav M4dhav linked an issue Nov 14, 2025 that may be closed by this pull request
@M4dhav
Copy link
Contributor

M4dhav commented Nov 14, 2025

Please follow the specified PR template and don't overwrite it in the future

@M4dhav
Copy link
Contributor

M4dhav commented Nov 14, 2025

Please test the workflow locally and share a video

Copy link
Contributor

@M4dhav M4dhav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for test video

@uju09
Copy link
Contributor Author

uju09 commented Nov 14, 2025

@M4dhav Sorry for PR body. I forgot.

@uju09
Copy link
Contributor Author

uju09 commented Nov 14, 2025

@M4dhav I don't have secrets with me. Testing it locally is not possible.

@M4dhav
Copy link
Contributor

M4dhav commented Nov 14, 2025

You can setup your own secrets locally on your fork

@uju09
Copy link
Contributor Author

uju09 commented Nov 14, 2025

Where to get secrets. I am in Web dev. I don't know much about App dev and its release.

@uju09
Copy link
Contributor Author

uju09 commented Nov 14, 2025

@M4dhav Can you test it on test branch. I request you.

@M4dhav
Copy link
Contributor

M4dhav commented Nov 14, 2025

Where to get secrets. I am in Web dev. I don't know much about App dev and its release.

All of the secrets are self explanatory, and as this is for GitHub Release, you don't need credentials for an App Console account. You will be able to easily find where to generate which secret.

@M4dhav
Copy link
Contributor

M4dhav commented Nov 14, 2025

Can you test it on test branch. I request you.

I'm sorry, I do not have the time right now to do so

@uju09
Copy link
Contributor Author

uju09 commented Nov 14, 2025

@M4dhav Ok give me some time. I will try and share a video.

@uju09
Copy link
Contributor Author

uju09 commented Nov 25, 2025

@M4dhav I request you to test the workflow.

uju09 added 3 commits December 1, 2025 21:14
Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
@uju09
Copy link
Contributor Author

uju09 commented Dec 1, 2025

@coderabbitai Review.

@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

@uju09: I'll review the changes in this PR for you.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/build_and_deploy.yml (1)

27-42: Approve disk housekeeping; consider pinning the action version.

The disk space cleanup steps are well-placed and should resolve common CI/CD runner failures. The disk usage visibility aids debugging.

However, the free-disk-space@main action is unpinned to a specific version. This can cause reproducibility issues if the action changes behavior in the future.

Consider pinning to a specific version tag:

-        uses: jlumbroso/free-disk-space@main
+        uses: jlumbroso/free-disk-space@v1.16.0

You can check the latest stable version at https://github.com/jlumbroso/free-disk-space/releases.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b90b2e and 5b98286.

📒 Files selected for processing (1)
  • .github/workflows/build_and_deploy.yml (4 hunks)
🔇 Additional comments (2)
.github/workflows/build_and_deploy.yml (2)

58-65: Good placement and scope of build cleanup step.

The cleanup step is well-positioned after Flutter setup but before artifact builds, and comprehensively removes Flutter, Gradle, and cache artifacts. This should eliminate stale build cache issues.


106-119: Verify APK artifact path resolution and MIME type update.

The APK_RELEASE_PATH environment variable and MIME type update appear correct:

  • Path apk-release/app-release.apk should align with the upload structure (artifact name + filename)
  • MIME type application/vnd.android.package-archive is the standard type for Android packages

However, verification requires access to the workflow file's upload configuration (lines 94-98) to confirm that the artifact download on lines 110–112 places files in the expected apk-release/ directory so the path resolves correctly at release time. Specifically, verify that the upload step uses name: apk-release and that the file app-release.apk will be in the correct nested directory after download.

Comment on lines +35 to +39
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even have any of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had no idea what we have, so I thought to give it a try, and also it is future proof to clear the disk storage.

Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
@uju09
Copy link
Contributor Author

uju09 commented Dec 2, 2025

@M4dhav Changes have been made.

@uju09 uju09 requested a review from M4dhav December 2, 2025 10:15
Copy link
Contributor

@M4dhav M4dhav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow ran, but got this warning during second job and no builds were uploaded:

Image

@uju09
Copy link
Contributor Author

uju09 commented Dec 2, 2025

@M4dhav I think the name of file was wrong, I will fix it.

Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
@uju09
Copy link
Contributor Author

uju09 commented Dec 2, 2025

@M4dhav There was a typo, Now it will succeed.

@uju09 uju09 requested a review from M4dhav December 2, 2025 12:57
Copy link
Contributor

@M4dhav M4dhav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Errors like these will keep happening if you keep committing AI generated code without looking it over

Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
@uju09
Copy link
Contributor Author

uju09 commented Dec 3, 2025

@M4dhav I am sorry for irritating. Due to consistent errors, I took suggestions from AI and my seniors and updated the release action version to latest. It is my fault, I would have checked earlier whether it is right or not. I apologize for that. Don't know why but this workflow is taking too much time, though it should not take, but it is giving trouble and all types of errors, so I was trying to analyse it from every angle.

@uju09
Copy link
Contributor Author

uju09 commented Dec 3, 2025

@M4dhav Now I think everything is fine... and it should do its job.

@M4dhav
Copy link
Contributor

M4dhav commented Dec 3, 2025

@M4dhav I am sorry for irritating. Due to consistent errors, I took suggestions from AI and my seniors and updated the release action version to latest. It is my fault, I would have checked earlier whether it is right or not. I apologize for that. Don't know why but this workflow is taking too much time, though it should not take, but it is giving trouble and all types of errors, so I was trying to analyse it from every angle.

It is alright.

The workflow is working fine now.

Could you make a few more modifications please? The Build Tag and Release Notes should be fetched from the Changelog

Signed-off-by: uju09 <24bcs012@iiitdwd.ac.in>
@uju09
Copy link
Contributor Author

uju09 commented Dec 5, 2025

@M4dhav Hey, I think we should write our CHANGELOG.md in order of latest version. Currently the latest version is at last, can we modify it , so it becomes easy for contributors and for job too for parsing.

@uju09
Copy link
Contributor Author

uju09 commented Dec 5, 2025

Should we make a script for parsing or it should be added within workflow? Which approach to follow?
Screenshot 2025-12-05 at 1 27 16 PM
Screenshot 2025-12-05 at 1 30 20 PM

@M4dhav
Copy link
Contributor

M4dhav commented Dec 9, 2025

@M4dhav Hey, I think we should write our CHANGELOG.md in order of latest version. Currently the latest version is at last, can we modify it , so it becomes easy for contributors and for job too for parsing.

If that is the case, then sure, we can have it top to bottom. Please feel free to raise a PR for the same

@uju09
Copy link
Contributor Author

uju09 commented Dec 9, 2025

@M4dhav Ok then I will create an issue. Currently I am busy with my internship, I am will try to resolve all assigned issue as soon as possible.

@uju09
Copy link
Contributor Author

uju09 commented Dec 21, 2025

@M4dhav I have added the section that extracts release notes from CHANGELOG.md. I request you to review it.

@uju09 uju09 requested a review from M4dhav December 21, 2025 05:47
@M4dhav
Copy link
Contributor

M4dhav commented Dec 26, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/build_and_deploy.yml (1)

59-69: Clarify the step name to distinguish from earlier cleanup.

The step "Show disk usage after cleanup" at line 68 has the same name as line 41-42, making logs harder to navigate. Since this displays disk state after Flutter/Gradle cleanup specifically, consider renaming it to "Show disk usage after Flutter cleanup" or similar.

🔎 Suggested rename
-      - name: Show disk usage after cleanup
+      - name: Show disk usage after Flutter cleanup
         run: df -h /

Note on aggressive cleanup vs. build performance.

Removing all Gradle caches, daemon, and Android build-cache will force full rebuilds and significantly increase build time. This is appropriate for disk-constrained environments but consider whether partial cache retention could balance space and performance once the immediate disk issue is resolved.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b98286 and 1d5d5ee.

📒 Files selected for processing (1)
  • .github/workflows/build_and_deploy.yml
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: M4dhav
Repo: AOSSIE-Org/Resonate PR: 510
File: .github/workflows/build_and_deploy.yml:31-36
Timestamp: 2025-08-31T16:18:53.594Z
Learning: For the AOSSIE-Org/Resonate project, build system requirements like Java version setup are considered separate from dependency update PRs and should be handled in dedicated PRs focused on build system improvements.
🔇 Additional comments (4)
.github/workflows/build_and_deploy.yml (4)

27-42: LGTM: Disk space management approach is sound.

The before/after disk usage visibility combined with targeted cleanup is a good debugging and maintenance strategy. Correctly preserving Android SDK while clearing other resources.


110-111: LGTM: APK artifact path flow is consistent.

The introduction of APK_RELEASE_PATH with the matching download directory and glob pattern creates a clean, maintainable artifact flow.

Also applies to: 147-147, 153-153


113-114: LGTM: Checkout step is necessary for CHANGELOG access.

Adding the repository checkout in the deploy job correctly enables the CHANGELOG parsing step that follows.


155-156: Dynamic release metadata from CHANGELOG is a good approach.

Using parsed values from CHANGELOG.md for the tag and release body enables single-source-of-truth versioning. However, this relies on robust parsing with error handling (see comment on lines 116-141).

Comment on lines +116 to +141
- name: Parse Build Tag & Release Notes from CHANGELOG.md
id: parse_changelog
run: |
echo "Parsing CHANGELOG.md"
awk '
BEGIN {found=0}
/^##[[:space:]]*\[?v?[0-9]+\.[0-9]+\.[0-9]+.*\]?/ && found==0 {
line=$0
gsub(/^##[[:space:]]*/, "", line)
sub(/[[:space:]]+-[[:space:]]*.*$/, "", line)
gsub(/^\[|\]$/, "", line)
tag=line
if (tag !~ /^v/) tag = "v" tag
found=1
next
}
found==1 {
if (/^##[[:space:]]+/) exit
notes = notes $0 "\n"
}
END {
printf("build_tag=%s\n", tag)
printf("release_notes<<EOF\n%s\nEOF\n", notes)
}
' CHANGELOG.md >> $GITHUB_OUTPUT
Copy link

@coderabbitai coderabbitai bot Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, check if CHANGELOG.md exists and examine its format
git ls-files | grep -i changelog

Repository: AOSSIE-Org/Resonate

Length of output: 45


🏁 Script executed:

# Also check the workflow file context around the snippet
find . -name "build_and_deploy.yml" -o -name "*.yml" -path "*workflows*"

Repository: AOSSIE-Org/Resonate

Length of output: 316


🏁 Script executed:

# Check file size of build_and_deploy.yml
wc -l ./.github/workflows/build_and_deploy.yml

Repository: AOSSIE-Org/Resonate

Length of output: 107


🏁 Script executed:

# Read the workflow file around the snippet area (lines 100-150)
sed -n '100,150p' ./.github/workflows/build_and_deploy.yml

Repository: AOSSIE-Org/Resonate

Length of output: 1514


🏁 Script executed:

# Check if there are any changelog files with different names
find . -type f \( -name "*change*" -o -name "*CHANGE*" \) | head -20

Repository: AOSSIE-Org/Resonate

Length of output: 316


🏁 Script executed:

# Check the entire repository for any changelog file
find . -type f -name "*[Cc][Hh][Aa][Nn][Gg]*" 2>/dev/null

Repository: AOSSIE-Org/Resonate

Length of output: 316


🏁 Script executed:

# Check if CHANGELOG.md exists in the root
ls -la CHANGELOG.md 2>&1

Repository: AOSSIE-Org/Resonate

Length of output: 122


🏁 Script executed:

# Read the full workflow file to see all steps and understand the complete context
cat -n ./.github/workflows/build_and_deploy.yml

Repository: AOSSIE-Org/Resonate

Length of output: 5807


🏁 Script executed:

# Check if CHANGELOG.md exists in git history or other branches
git log --all --full-history --pretty=format:"%H %s" -- CHANGELOG.md 2>&1 | head -5

Repository: AOSSIE-Org/Resonate

Length of output: 45


🏁 Script executed:

# Check all branches to see if CHANGELOG.md exists anywhere
git branch -a --format='%(refname:short)' | xargs -I {} sh -c 'git ls-tree -r {} -- CHANGELOG.md >/dev/null 2>&1 && echo "Found in: {}"'

Repository: AOSSIE-Org/Resonate

Length of output: 205


🏁 Script executed:

# Let's trace what happens in the workflow if the file doesn't exist
# Simulate what awk does with a missing file
echo "Testing awk behavior with missing file:"
awk 'BEGIN {print "starting"}' /nonexistent/file 2>&1; echo "Exit code: $?"

Repository: AOSSIE-Org/Resonate

Length of output: 124


🏁 Script executed:

# Check which branch we're on and if CHANGELOG.md exists there
git branch -vv

Repository: AOSSIE-Org/Resonate

Length of output: 360


🏁 Script executed:

# Check git status
git status

Repository: AOSSIE-Org/Resonate

Length of output: 128


🏁 Script executed:

# Try to checkout or show CHANGELOG.md from master
git show master:CHANGELOG.md 2>&1 | head -30

Repository: AOSSIE-Org/Resonate

Length of output: 116


🏁 Script executed:

# Check if CHANGELOG.md exists in the current branch (coderabbit_602)
cat CHANGELOG.md 2>&1 | head -50

Repository: AOSSIE-Org/Resonate

Length of output: 107


🏁 Script executed:

# Also check the git log to understand the commit
git log --oneline -1

Repository: AOSSIE-Org/Resonate

Length of output: 129


🏁 Script executed:

# Show what files were changed in the current commit/branch
git diff --name-only coderabbit_602...master 2>/dev/null | grep -i change

Repository: AOSSIE-Org/Resonate

Length of output: 45


🏁 Script executed:

# Check the current commit to see what was changed
git show --stat HEAD

Repository: AOSSIE-Org/Resonate

Length of output: 24217


🏁 Script executed:

# List all files in the current directory to see what exists
ls -la

Repository: AOSSIE-Org/Resonate

Length of output: 1900


🏁 Script executed:

# Check if CHANGELOG.md was added in this commit
git show HEAD --name-status | head -20

Repository: AOSSIE-Org/Resonate

Length of output: 835


🏁 Script executed:

# Check if there's a git tag or version info in any other file
grep -r "version" . --include="*.yaml" --include="*.yml" --include="*.md" 2>/dev/null | grep -i "changelog\|release\|version" | head -20

Repository: AOSSIE-Org/Resonate

Length of output: 7110


🏁 Script executed:

# Simulate what happens with the awk script when CHANGELOG.md doesn't exist
# and check what gets output to GITHUB_OUTPUT
cat > /tmp/test_awk.sh << 'EOF'
#!/bin/bash

# Create a fake GITHUB_OUTPUT
GITHUB_OUTPUT=/tmp/github_output.txt
rm -f $GITHUB_OUTPUT

# Run the exact awk command from the workflow (without the file)
awk '
  BEGIN {found=0}
  /^##[[:space:]]*\[?v?[0-9]+\.[0-9]+\.[0-9]+.*\]?/ && found==0 {
    line=$0
    gsub(/^##[[:space:]]*/, "", line)
    sub(/[[:space:]]+-[[:space:]]*.*$/, "", line)
    gsub(/^\[|\]$/, "", line)
    tag=line
    if (tag !~ /^v/) tag = "v" tag
    found=1
    next
  }
  found==1 {
    if (/^##[[:space:]]+/) exit
    notes = notes $0 "\n"
  }
  END {
    printf("build_tag=%s\n", tag)
    printf("release_notes<<EOF\n%s\nEOF\n", notes)
  }
' /nonexistent/CHANGELOG.md >> $GITHUB_OUTPUT 2>&1

echo "Exit code: $?"
echo ""
echo "=== Content of GITHUB_OUTPUT ==="
cat $GITHUB_OUTPUT
echo ""
echo "=== Checking if tag is empty ==="
TAG=$(grep "build_tag=" $GITHUB_OUTPUT | cut -d'=' -f2)
if [ -z "$TAG" ]; then
  echo "ERROR: build_tag is empty!"
elif [ "$TAG" = "v" ]; then
  echo "ERROR: build_tag is just 'v' with no version!"
else
  echo "build_tag=$TAG"
fi
EOF
bash /tmp/test_awk.sh

Repository: AOSSIE-Org/Resonate

Length of output: 279


🏁 Script executed:

# Check the ncipollo/release-action documentation to see what happens with empty tag
# First, check if there are any test files or documentation in the repo about release
find . -name "*.md" -type f | xargs grep -l "release-action\|ncipollo" 2>/dev/null

Repository: AOSSIE-Org/Resonate

Length of output: 47


🏁 Script executed:

# Search for documentation or PRs related to the workflow
git log --all --oneline | grep -i "changelog\|release" | head -10

Repository: AOSSIE-Org/Resonate

Length of output: 723


🏁 Script executed:

# Check if there's a way to see what the release action does with empty tag
# Look at the full workflow again to see if there's any conditional logic
sed -n '149,156p' ./.github/workflows/build_and_deploy.yml

Repository: AOSSIE-Org/Resonate

Length of output: 403


🏁 Script executed:

# Let's verify the exact behavior: does awk exit with error when file missing?
echo "Testing awk exit behavior:"
awk 'BEGIN {print "test"}' /nonexistent/file >> /tmp/out.txt 2>&1
echo "AWK exit code when file missing: $?"
cat /tmp/out.txt

echo ""
echo "Checking if workflow would continue:"
set +e  # Don't exit on error
awk 'BEGIN {print "test"}' /nonexistent/file >> /tmp/out2.txt 2>&1
if [ $? -ne 0 ]; then
  echo "awk failed, but if set -e is not used, bash continues"
fi

Repository: AOSSIE-Org/Resonate

Length of output: 167


🏁 Script executed:

# This is critical - the workflow was added but CHANGELOG.md doesn't exist
# Let me check if the commit that added the workflow also added CHANGELOG.md
git show 1d5d5ee --name-status | grep -i changelog

Repository: AOSSIE-Org/Resonate

Length of output: 125


🏁 Script executed:

# Check if CHANGELOG.md was supposed to be in the commit
git show 1d5d5ee | grep -i "changelog" | head -20

Repository: AOSSIE-Org/Resonate

Length of output: 433


🏁 Script executed:

# Search the entire git history for any CHANGELOG file
git log --all --full-history --diff-filter=A --name-only --pretty=format: -- "*CHANGELOG*" | grep -v "^$"

Repository: AOSSIE-Org/Resonate

Length of output: 45


🏁 Script executed:

# Let's also verify: what happens when the release-action gets an empty or missing tag?
# Check ncipollo/release-action documentation or comments in the workflow
grep -A5 -B5 "ncipollo/release-action" ./.github/workflows/build_and_deploy.yml

Repository: AOSSIE-Org/Resonate

Length of output: 408


🏁 Script executed:

# Check if there are any other branches or recent changes that might have added CHANGELOG.md
git branch -a | xargs -I {} sh -c 'echo "=== Branch: {} ===" && git ls-tree -r {} -- CHANGELOG.md 2>/dev/null | head -1 || echo "Not found"'

Repository: AOSSIE-Org/Resonate

Length of output: 320


🏁 Script executed:

# Check the commit history around this workflow addition
git log --oneline --all -- ".github/workflows/build_and_deploy.yml" | head -10

Repository: AOSSIE-Org/Resonate

Length of output: 430


🏁 Script executed:

# Verify: what actually happens in the workflow when build_tag is empty
# Simulate the exact sequence in the workflow
cat > /tmp/simulate_workflow.sh << 'EOF'
#!/bin/bash
set +e

GITHUB_OUTPUT=/tmp/test_output.txt
rm -f $GITHUB_OUTPUT

echo "Step 1: Parse CHANGELOG.md (file doesn't exist)"
awk '
  BEGIN {found=0}
  /^##[[:space:]]*\[?v?[0-9]+\.[0-9]+\.[0-9]+.*\]?/ && found==0 {
    line=$0
    gsub(/^##[[:space:]]*/, "", line)
    sub(/[[:space:]]+-[[:space:]]*.*$/, "", line)
    gsub(/^\[|\]$/, "", line)
    tag=line
    if (tag !~ /^v/) tag = "v" tag
    found=1
    next
  }
  found==1 {
    if (/^##[[:space:]]+/) exit
    notes = notes $0 "\n"
  }
  END {
    printf("build_tag=%s\n", tag)
    printf("release_notes<<EOF\n%s\nEOF\n", notes)
  }
' CHANGELOG.md >> $GITHUB_OUTPUT 2>&1

PARSE_EXIT=$?
echo "AWK exit code: $PARSE_EXIT"

echo ""
echo "Step 2: Extract build_tag value"
BUILD_TAG=$(grep "^build_tag=" $GITHUB_OUTPUT 2>/dev/null | cut -d'=' -f2)
echo "BUILD_TAG value: '$BUILD_TAG'"

echo ""
echo "Step 3: What would be passed to release-action"
echo "Tag parameter: '$BUILD_TAG'"

if [ -z "$BUILD_TAG" ]; then
  echo "⚠️  ISSUE: Tag is empty - release-action will fail or use default tag"
fi

echo ""
echo "Full GITHUB_OUTPUT content:"
cat $GITHUB_OUTPUT
EOF
bash /tmp/simulate_workflow.sh

Repository: AOSSIE-Org/Resonate

Length of output: 441


🏁 Script executed:

# Final check: was CHANGELOG.md supposed to be created but forgotten?
# Look at the commit message and diff more carefully
git show 1d5d5ee | grep -A3 -B3 "CHANGELOG" || echo "No CHANGELOG mentioned in commit details"

Repository: AOSSIE-Org/Resonate

Length of output: 783


CHANGELOG.md is missing from the repository – workflow cannot function.

The AWK parsing step will fail immediately because the file doesn't exist. When awk tries to read CHANGELOG.md, it returns exit code 2 with error: cannot open file 'CHANGELOG.md' for reading: No such file or directory. This leaves build_tag as an empty string, which is then passed to the release-action, causing the release step to fail.

Two fixes are required:

  1. Create CHANGELOG.md in the repository root with version entries matching the regex pattern: ## [v]X.Y.Z
  2. Add error handling to validate file existence and non-empty parsed values before proceeding to the release step
🤖 Prompt for AI Agents
.github/workflows/build_and_deploy.yml around lines 116-141: the workflow
assumes CHANGELOG.md exists and AWK will fail (exit code 2) if the file is
missing, leaving build_tag empty and breaking the release step; fix by (1)
adding a CHANGELOG.md at the repository root with entries matching the expected
header pattern (## [v]X.Y.Z) so the parser has data, and (2) adding workflow
error handling before the release-action to check that CHANGELOG.md exists and
that parsed outputs (build_tag and release_notes) are non-empty — if the file is
missing or parsing yields empty values, fail fast with a clear error message (or
skip release) so the release step is not invoked with empty inputs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore this, the changelog file exists. Review the rest of the code, specifically the parsing step

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

echo "=== Checking CHANGELOG.md existence and format ==="
if [ -f CHANGELOG.md ]; then
    echo "✓ CHANGELOG.md exists"
    echo ""
    echo "=== First 50 lines of CHANGELOG.md ==="
    head -n 50 CHANGELOG.md
    echo ""
    echo "=== All version headers found ==="
    grep -n "^##" CHANGELOG.md | head -20
else
    echo "✗ CHANGELOG.md not found"
    exit 1
fi

echo ""
echo "=== Testing the AWK parsing script ==="
GITHUB_OUTPUT=/tmp/test_github_output.txt
rm -f $GITHUB_OUTPUT

awk '
  BEGIN {found=0}
  /^##[[:space:]]*\[?v?[0-9]+\.[0-9]+\.[0-9]+.*\]?/ && found==0 {
    line=$0
    gsub(/^##[[:space:]]*/, "", line)
    sub(/[[:space:]]+-[[:space:]]*.*$/, "", line)
    gsub(/^\[|\]$/, "", line)
    tag=line
    if (tag !~ /^v/) tag = "v" tag
    found=1
    next
  }
  found==1 {
    if (/^##[[:space:]]+/) exit
    notes = notes $0 "\n"
  }
  END {
    printf("build_tag=%s\n", tag)
    printf("release_notes<<EOF\n%s\nEOF\n", notes)
  }
' CHANGELOG.md > $GITHUB_OUTPUT

echo "Exit code: $?"
echo ""
echo "=== Parsed output ==="
cat $GITHUB_OUTPUT
echo ""
echo "=== Extracted values ==="
echo "build_tag: $(grep "^build_tag=" $GITHUB_OUTPUT | cut -d'=' -f2)"
echo ""
echo "release_notes (first 300 chars):"
sed -n '/release_notes<<EOF/,/^EOF$/p' $GITHUB_OUTPUT | head -n 15

Length of output: 75


🏁 Script executed:

#!/bin/bash

echo "=== Checking for CHANGELOG.md in different locations ==="

# Check if file exists on master branch
echo "1. Checking master branch:"
git ls-tree -r master --name-only | grep -i changelog

echo ""
echo "2. Checking dev branch:"
git ls-tree -r dev --name-only | grep -i changelog

echo ""
echo "3. Checking current branch:"
git ls-tree -r HEAD --name-only | grep -i changelog

echo ""
echo "4. Finding any changelog-like files in repo:"
find . -type f -iname "*change*" 2>/dev/null | grep -v ".git"

echo ""
echo "5. Checking if CHANGELOG.md exists on master:"
git show master:CHANGELOG.md 2>&1 | head -n 50

echo ""
echo "6. Current branch name:"
git branch --show-current

Length of output: 563


@M4dhav, I'll focus on the AWK parsing logic as requested.

Critical Issue: Regex Inconsistency

The AWK script has a regex pattern mismatch that will cause incorrect parsing:

Line 122 (version header matching):

/^##[[:space:]]*\[?v?[0-9]+\.[0-9]+\.[0-9]+.*\]?/

Uses [[:space:]]* — allows zero or more spaces after ##

Line 130 (exit condition for notes):

if (/^##[[:space:]]+/) exit

Uses [[:space:]]+ — requires one or more spaces after ##

Impact

If CHANGELOG.md contains headers without spaces (e.g., ##Features, ##[2.0.0], ##Fixes), the script will:

  1. ✅ Correctly match version header like ##v1.0.0
  2. Fail to stop at ##Features because it has zero spaces
  3. ❌ Include subsequent headers and content in release_notes

Recommended Fix

Make the patterns consistent:

# Option 1: Both require at least one space
/^##[[:space:]]+\[?v?[0-9]+\.[0-9]+\.[0-9]+.*\]?/  # Line 122
if (/^##[[:space:]]+/) exit                         # Line 130 (unchanged)

# Option 2: Both allow zero or more spaces (safer for varied formats)
/^##[[:space:]]*\[?v?[0-9]+\.[0-9]+\.[0-9]+.*\]?/  # Line 122 (unchanged)
if (/^##[[:space:]]*/) exit                         # Line 130 (change to *)

Recommendation: Use Option 2 to handle various CHANGELOG formats robustly.

Additional Issues

  1. No validation for empty tag: If no version is found, tag remains empty, outputting build_tag=v (just the prefix). Add validation in the END block:

    END {
      if (tag == "") {
        print "ERROR: No version found in CHANGELOG.md" > "/dev/stderr"
        exit 1
      }
      printf("build_tag=%s\n", tag)
      printf("release_notes<<EOF\n%s\nEOF\n", notes)
    }
  2. Trailing newline in notes: Each line appends \n, resulting in an extra trailing newline. While not critical, you could trim it:

    END {
      sub(/\n$/, "", notes)  # Remove final trailing newline
      printf("build_tag=%s\n", tag)
      printf("release_notes<<EOF\n%s\nEOF\n", notes)
    }

Would you like me to provide the complete corrected AWK script?


🧠 Learnings used
Learnt from: M4dhav
Repo: AOSSIE-Org/Resonate PR: 510
File: .github/workflows/build_and_deploy.yml:31-36
Timestamp: 2025-08-31T16:18:53.594Z
Learning: For the AOSSIE-Org/Resonate project, build system requirements like Java version setup are considered separate from dependency update PRs and should be handled in dedicated PRs focused on build system improvements.

@uju09
Copy link
Contributor Author

uju09 commented Dec 26, 2025

@M4dhav The CHANGELOG.md doesn't yet exist on master branch, coderabbit is hallucinating.

@M4dhav
Copy link
Contributor

M4dhav commented Dec 26, 2025

Thank you for the contribution, great work. I tested this on my local and it works fine.

@M4dhav M4dhav merged commit d934d2f into AOSSIE-Org:dev Dec 26, 2025
2 checks passed
@github-actions
Copy link
Contributor

PR Closed - Thank You, @uju09!

  • If this PR was merged: Congratulations! Your contribution is now part of the project. 🚀
  • If this PR was closed without merging: Don’t worry! You can always improve it and submit again. 💪

We appreciate your effort and look forward to more contributions from you! 🤝

@uju09 uju09 deleted the build_deploy_workflow branch December 27, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Build and Deploy workflow

2 participants