-
Notifications
You must be signed in to change notification settings - Fork 47
fix: resolve release pipeline failure - missing function definitions #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The release pipeline was failing because the Play Store upload job tried to source /tmp/release_functions.sh which was created in a different job. Since GitHub Actions jobs run in isolated environments, files from one job aren't available in another. This fix duplicates the function definitions directly in the Play Store upload job to ensure the required functions are available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a critical release pipeline failure that was preventing the V2er Android app from uploading to the Play Store. The issue was caused by a missing function definitions file that was expected to be available across different GitHub Actions jobs.
Key changes:
- Duplicated function definitions directly in the Play Store upload job to resolve cross-job file availability issues
- Added the
categorize_commitandget_github_usernamefunctions inline to eliminate dependency on external file
| # Define shared functions (duplicated from release job since jobs run in isolation) | ||
| cat > /tmp/release_functions.sh << 'FUNCTIONS_EOF' | ||
| # Function to categorize commit message | ||
| categorize_commit() { | ||
| local msg="$1" | ||
| local category="" | ||
| local cleaned_msg="" | ||
| if [[ "$msg" =~ ^fix(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^fix\ (.*)$ ]]; then | ||
| category="bug" | ||
| cleaned_msg="${BASH_REMATCH[-1]}" | ||
| elif [[ "$msg" =~ ^feat(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^feat\ (.*)$ ]]; then | ||
| category="feature" | ||
| cleaned_msg="${BASH_REMATCH[-1]}" | ||
| elif [[ "$msg" =~ ^perf(\(.*\))?:\ (.*)$ ]]; then | ||
| category="performance" | ||
| cleaned_msg="${BASH_REMATCH[2]}" | ||
| elif [[ "$msg" =~ ^refactor(\(.*\))?:\ (.*)$ ]]; then | ||
| category="improvement" | ||
| cleaned_msg="${BASH_REMATCH[2]}" | ||
| elif [[ "$msg" =~ ^chore(\(.*\))?:\ (.*)$ ]]; then | ||
| category="maintenance" | ||
| cleaned_msg="${BASH_REMATCH[2]}" | ||
| elif [[ "$msg" =~ ^docs(\(.*\))?:\ (.*)$ ]]; then | ||
| category="documentation" | ||
| cleaned_msg="${BASH_REMATCH[2]}" | ||
| else | ||
| category="other" | ||
| cleaned_msg="$msg" | ||
| fi | ||
| # Remove PR numbers from the end | ||
| cleaned_msg=$(echo "$cleaned_msg" | sed 's/ (#[0-9]*)//') | ||
| # Capitalize first letter | ||
| cleaned_msg="$(echo "${cleaned_msg:0:1}" | tr '[:lower:]' '[:upper:]')${cleaned_msg:1}" | ||
| echo "$category:$cleaned_msg" | ||
| } | ||
| # Function to get GitHub username from commit | ||
| get_github_username() { | ||
| local commit_sha="$1" | ||
| local github_repo="${GITHUB_REPOSITORY}" | ||
| # Try to get the GitHub username from the commit using gh api | ||
| local username=$(gh api "repos/${github_repo}/commits/${commit_sha}" --jq '.author.login // empty' 2>/dev/null || echo "") | ||
| if [ -n "$username" ]; then | ||
| echo "@$username" | ||
| else | ||
| # Fallback: try to get committer login if author login is not available | ||
| local committer=$(gh api "repos/${github_repo}/commits/${commit_sha}" --jq '.committer.login // empty' 2>/dev/null || echo "") | ||
| if [ -n "$committer" ]; then | ||
| echo "@$committer" | ||
| else | ||
| # Last resort: use hardcoded mapping for known authors | ||
| local git_author=$(git show -s --format='%an' $commit_sha) | ||
| case "$git_author" in | ||
| "Gray Zhang" | "gray" | "Gray") | ||
| echo "@graycreate" | ||
| ;; | ||
| "github-actions[bot]") | ||
| echo "@github-actions[bot]" | ||
| ;; | ||
| *) | ||
| # If no mapping found, use git author name without @ | ||
| echo "$git_author" | ||
| ;; | ||
| esac | ||
| fi | ||
| fi | ||
| } | ||
| FUNCTIONS_EOF |
Copilot
AI
Sep 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duplicates a significant amount of code (70+ lines) that appears to exist elsewhere in the workflow. Consider using GitHub Actions artifacts or a shared script file to avoid code duplication and reduce maintenance burden.
| cleaned_msg="${BASH_REMATCH[-1]}" | ||
| elif [[ "$msg" =~ ^feat(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^feat\ (.*)$ ]]; then | ||
| category="feature" | ||
| cleaned_msg="${BASH_REMATCH[-1]}" |
Copilot
AI
Sep 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent BASH_REMATCH array indexing. Lines 625 and 628 use [-1] while lines 631, 634, 637, and 640 use [2]. This could lead to incorrect message extraction for different commit types.
| cleaned_msg="${BASH_REMATCH[-1]}" | |
| elif [[ "$msg" =~ ^feat(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^feat\ (.*)$ ]]; then | |
| category="feature" | |
| cleaned_msg="${BASH_REMATCH[-1]}" | |
| cleaned_msg="${BASH_REMATCH[2]}" | |
| elif [[ "$msg" =~ ^feat(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^feat\ (.*)$ ]]; then | |
| category="feature" | |
| cleaned_msg="${BASH_REMATCH[2]}" |
| cleaned_msg="${BASH_REMATCH[-1]}" | ||
| elif [[ "$msg" =~ ^feat(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^feat\ (.*)$ ]]; then | ||
| category="feature" | ||
| cleaned_msg="${BASH_REMATCH[-1]}" |
Copilot
AI
Sep 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent BASH_REMATCH array indexing. Lines 625 and 628 use [-1] while lines 631, 634, 637, and 640 use [2]. This could lead to incorrect message extraction for different commit types.
| cleaned_msg="${BASH_REMATCH[-1]}" | |
| elif [[ "$msg" =~ ^feat(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^feat\ (.*)$ ]]; then | |
| category="feature" | |
| cleaned_msg="${BASH_REMATCH[-1]}" | |
| if [[ -n "${BASH_REMATCH[2]}" ]]; then | |
| cleaned_msg="${BASH_REMATCH[2]}" | |
| else | |
| cleaned_msg="${BASH_REMATCH[1]}" | |
| fi | |
| elif [[ "$msg" =~ ^feat(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^feat\ (.*)$ ]]; then | |
| category="feature" | |
| if [[ -n "${BASH_REMATCH[2]}" ]]; then | |
| cleaned_msg="${BASH_REMATCH[2]}" | |
| else | |
| cleaned_msg="${BASH_REMATCH[1]}" | |
| fi |
Summary
/tmp/release_functions.sh: No such file or directoryRoot Cause
The Play Store upload job was trying to source
/tmp/release_functions.shwhich was created in a different job (Create GitHub Release). Since GitHub Actions jobs run in isolated environments, files created in one job are not available in another job.Solution
Duplicated the function definitions (
categorize_commitandget_github_username) directly in the Play Store upload job's "Create whatsnew directory" step to ensure the required functions are available.Testing
This fix ensures the release pipeline will complete successfully and upload the APK to Google Play Store.
🤖 Generated with Claude Code