From 9fcabb9825a563dd04663bbc0eccbe18f9068a1b Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 11:52:34 +0300 Subject: [PATCH 01/13] small update --- config/crd/bases/appstudio.redhat.com_releaseplans.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/crd/bases/appstudio.redhat.com_releaseplans.yaml b/config/crd/bases/appstudio.redhat.com_releaseplans.yaml index 6d5af1a4e..23825ffd1 100644 --- a/config/crd/bases/appstudio.redhat.com_releaseplans.yaml +++ b/config/crd/bases/appstudio.redhat.com_releaseplans.yaml @@ -27,7 +27,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: ReleasePlan is the Schema for the ReleasePlans API. + description: ReleasePlan is the Schema for the ReleasePlans API. This resource defines release configurations for applications. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation From 1425c7c0c1d49e28b73ffb8303b5cd50e28a9349 Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 12:30:01 +0300 Subject: [PATCH 02/13] update --- .../bases/appstudio.redhat.com_releases.yaml | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/config/crd/bases/appstudio.redhat.com_releases.yaml b/config/crd/bases/appstudio.redhat.com_releases.yaml index c56548049..9ba4e930b 100644 --- a/config/crd/bases/appstudio.redhat.com_releases.yaml +++ b/config/crd/bases/appstudio.redhat.com_releases.yaml @@ -22,6 +22,12 @@ spec: - jsonPath: .spec.releasePlan name: ReleasePlan type: string + - jsonPath: .spec.environment + name: Environment + type: string + - jsonPath: .status.phase + name: Phase + type: string - jsonPath: .status.conditions[?(@.type=="Released")].reason name: Release status type: string @@ -31,7 +37,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: Release is the Schema for the releases API + description: Release is the Schema for the releases API. This resource manages application releases across different environments with rollback capabilities. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -48,15 +54,32 @@ spec: spec: description: ReleaseSpec defines the desired state of Release. properties: + environment: + description: Environment specifies the target deployment environment (e.g., development, staging, production) + enum: + - development + - staging + - production + - testing + type: string + gracePeriodSeconds: + description: GracePeriodSeconds defines the grace period for release shutdown operations + format: int64 + minimum: 0 + type: integer releasePlan: description: ReleasePlan to use for this particular Release pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ type: string + rollbackEnabled: + description: RollbackEnabled indicates whether automatic rollback is enabled for this release + type: boolean snapshot: description: Snapshot to be released pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ type: string required: + - environment - releasePlan - snapshot type: object @@ -80,6 +103,16 @@ spec: description: Automated indicates whether the Release was created as part of an automated process or manually by an end-user type: boolean + phase: + description: Phase represents the current phase of the Release lifecycle (e.g., Preparing, InProgress, Completed, Failed, RolledBack) + enum: + - Preparing + - InProgress + - Completed + - Failed + - RolledBack + - Cancelled + type: string completionTime: description: CompletionTime is the time when a Release was completed format: date-time From 79a0fcf5fd482b1dbe9818fe7b20c0285c0b9251 Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 13:57:37 +0300 Subject: [PATCH 03/13] add reference to commits --- scripts/suggest_docs.py | 91 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 4 deletions(-) diff --git a/scripts/suggest_docs.py b/scripts/suggest_docs.py index 169de6284..0dddb0bfa 100644 --- a/scripts/suggest_docs.py +++ b/scripts/suggest_docs.py @@ -14,6 +14,69 @@ def get_diff(): result = subprocess.run(["git", "diff", "origin/main...HEAD"], capture_output=True, text=True) return result.stdout.strip() +def get_commit_info(): + """Get commit information for the documentation PR reference""" + try: + # Get current commit hash + current_commit = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True) + if current_commit.returncode != 0: + return None + + # Get remote origin URL to construct proper commit links + remote_url = subprocess.run(["git", "config", "--get", "remote.origin.url"], capture_output=True, text=True) + if remote_url.returncode != 0: + return None + + # Convert SSH URL to HTTPS if needed + repo_url = remote_url.stdout.strip() + if repo_url.startswith("git@github.com:"): + repo_url = repo_url.replace("git@github.com:", "https://github.com/").replace(".git", "") + elif repo_url.endswith(".git"): + repo_url = repo_url.replace(".git", "") + + # Get commit details + commit_hash = current_commit.stdout.strip() + short_hash = commit_hash[:7] + + # Get commit message + commit_msg = subprocess.run(["git", "log", "-1", "--pretty=format:%s", commit_hash], capture_output=True, text=True) + + # Get commits in the range from main to HEAD + commits_log = subprocess.run(["git", "log", "--oneline", "origin/main...HEAD"], capture_output=True, text=True) + + if commits_log.returncode == 0 and commits_log.stdout.strip(): + # Multiple commits + commits = commits_log.stdout.strip().split('\n') + commit_list = [] + for commit_line in commits: + if commit_line.strip(): + parts = commit_line.split(' ', 1) + if len(parts) >= 2: + hash_part = parts[0] + msg_part = parts[1] + commit_list.append(f"- [{hash_part}]({repo_url}/commit/{hash_part}) {msg_part}") + + return { + 'repo_url': repo_url, + 'current_commit': commit_hash, + 'short_hash': short_hash, + 'commit_message': commit_msg.stdout.strip() if commit_msg.returncode == 0 else '', + 'commits_list': commit_list + } + else: + # Single commit or no commits + return { + 'repo_url': repo_url, + 'current_commit': commit_hash, + 'short_hash': short_hash, + 'commit_message': commit_msg.stdout.strip() if commit_msg.returncode == 0 else '', + 'commits_list': [f"- [{short_hash}]({repo_url}/commit/{commit_hash}) {commit_msg.stdout.strip() if commit_msg.returncode == 0 else ''}"] + } + + except Exception as e: + print(f"Warning: Could not get commit info: {e}") + return None + def clone_docs_repo(): subprocess.run(["git", "clone", DOCS_REPO_URL, "docs_repo"]) os.chdir("docs_repo") @@ -133,7 +196,7 @@ def overwrite_file(file_path, new_content): print(f"Failed to write {file_path}: {e}") return False -def push_and_open_pr(modified_files): +def push_and_open_pr(modified_files, commit_info=None): subprocess.run(["git", "add"] + modified_files) subprocess.run([ "git", "commit", @@ -146,11 +209,20 @@ def push_and_open_pr(modified_files): subprocess.run(["git", "remote", "set-url", "origin", docs_repo_url]) subprocess.run(["git", "push", "--set-upstream", "origin", BRANCH_NAME, "--force"]) + # Build PR body with commit references + pr_body = "This PR updates the following documentation files based on code changes:\n\n" + pr_body += "\n".join([f"- `{f}`" for f in modified_files]) + + if commit_info: + pr_body += "\n\n## Source Code Changes\n\n" + pr_body += f"These documentation updates are based on the following commits from [{commit_info['repo_url'].split('/')[-1]}]({commit_info['repo_url']}):\n\n" + pr_body += "\n".join(commit_info['commits_list']) + pr_body += f"\n\n**Latest commit:** [{commit_info['short_hash']}]({commit_info['repo_url']}/commit/{commit_info['current_commit']})" + subprocess.run([ "gh", "pr", "create", "--title", "Auto-Generated Doc Updates from Code PR", - "--body", f"This PR updates the following documentation files based on the code changes:\n\n" + - "\n".join([f"- `{f}`" for f in modified_files]), + "--body", pr_body, "--base", "main", "--head", BRANCH_NAME ]) @@ -165,6 +237,12 @@ def main(): print("No changes detected.") return + # Get commit info before switching to docs repo + commit_info = get_commit_info() + if commit_info: + print(f"Source repository: {commit_info['repo_url']}") + print(f"Latest commit: {commit_info['short_hash']} - {commit_info['commit_message']}") + clone_docs_repo() previews = get_file_previews() @@ -201,8 +279,13 @@ def main(): print("[Dry Run] Would push and open PR for the following files:") for f in modified_files: print(f"- {f}") + if commit_info: + print(f"\n[Dry Run] PR would include commit references from: {commit_info['repo_url']}") + print("[Dry Run] Source commits:") + for commit in commit_info['commits_list']: + print(f" {commit}") else: - push_and_open_pr(modified_files) + push_and_open_pr(modified_files, commit_info) else: print("All documentation is already up to date — no PR created.") From a8e58b8c60656a9346cba45820eac23ea63068cf Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 14:01:51 +0300 Subject: [PATCH 04/13] update --- ...udio.redhat.com_releaseplanadmissions.yaml | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml b/config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml index 8647dfda2..2c32384a3 100644 --- a/config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml +++ b/config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml @@ -24,11 +24,20 @@ spec: - jsonPath: .spec.origin name: Origin type: string + - jsonPath: .spec.approvalMode + name: Approval + type: string + - jsonPath: .status.phase + name: Phase + type: string + - jsonPath: .spec.autoRelease + name: Auto-Release + type: boolean name: v1alpha1 schema: openAPIV3Schema: description: ReleasePlanAdmission is the Schema for the ReleasePlanAdmissions - API. + API. This resource controls approval workflows and automated release processes for applications. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -51,6 +60,16 @@ spec: items: type: string type: array + approvalMode: + description: ApprovalMode defines the approval process for releases (manual, automatic, or policy-based) + enum: + - manual + - automatic + - policy-based + type: string + autoRelease: + description: AutoRelease enables automatic release creation when conditions are met + type: boolean data: description: Data is an unstructured key used for providing data for the release Pipeline @@ -61,6 +80,25 @@ spec: release the Application pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ type: string + notificationConfig: + description: NotificationConfig defines notification settings for release events + properties: + channels: + description: Channels specifies where notifications should be sent (e.g., slack, email) + items: + type: string + type: array + events: + description: Events specifies which events trigger notifications + items: + enum: + - release-started + - release-completed + - release-failed + - approval-required + type: string + type: array + type: object origin: description: Origin references where the release requests should come from @@ -111,6 +149,7 @@ spec: type: string required: - applications + - approvalMode - origin - pipelineRef - policy @@ -206,6 +245,15 @@ spec: type: string type: object type: array + phase: + description: Phase represents the current phase of the ReleasePlanAdmission (e.g., Active, Pending, Disabled, Error) + enum: + - Active + - Pending + - Disabled + - Error + - Validating + type: string type: object type: object served: true From 1b92f277cf3a869fd77cca2548a9ec9ffcf1d8b3 Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 14:16:42 +0300 Subject: [PATCH 05/13] update the commits in docs repo to include reference to the commits from the code repo --- scripts/suggest_docs.py | 57 ++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/scripts/suggest_docs.py b/scripts/suggest_docs.py index 0dddb0bfa..b7e3e4a4a 100644 --- a/scripts/suggest_docs.py +++ b/scripts/suggest_docs.py @@ -198,9 +198,30 @@ def overwrite_file(file_path, new_content): def push_and_open_pr(modified_files, commit_info=None): subprocess.run(["git", "add"] + modified_files) + + # Build commit message with source commit references + commit_msg = "Auto-generated doc updates from code PR" + + if commit_info: + commit_msg += f"\n\nSource commits from {commit_info['repo_url'].split('/')[-1]}:" + for commit_line in commit_info['commits_list']: + # Extract hash and message from markdown format + # Format: "- [hash](url) message" + if commit_line.startswith("- [") and "](" in commit_line: + start = commit_line.find("[") + 1 + end = commit_line.find("]") + hash_part = commit_line[start:end] + msg_start = commit_line.find(") ") + 2 + msg_part = commit_line[msg_start:] if msg_start > 1 else "" + commit_msg += f"\n- {hash_part}: {msg_part}" + + commit_msg += f"\n\nLatest: {commit_info['short_hash']} - {commit_info['commit_message']}" + + commit_msg += "\n\nAssisted-by: Gemini" + subprocess.run([ "git", "commit", - "-m", "Auto-generated doc updates from code PR\n\nAssisted-by: Gemini" + "-m", commit_msg ]) # Add remote with token auth gh_token = os.environ["GH_TOKEN"] @@ -209,15 +230,10 @@ def push_and_open_pr(modified_files, commit_info=None): subprocess.run(["git", "remote", "set-url", "origin", docs_repo_url]) subprocess.run(["git", "push", "--set-upstream", "origin", BRANCH_NAME, "--force"]) - # Build PR body with commit references + # Build PR body (simple, without commit references) pr_body = "This PR updates the following documentation files based on code changes:\n\n" pr_body += "\n".join([f"- `{f}`" for f in modified_files]) - - if commit_info: - pr_body += "\n\n## Source Code Changes\n\n" - pr_body += f"These documentation updates are based on the following commits from [{commit_info['repo_url'].split('/')[-1]}]({commit_info['repo_url']}):\n\n" - pr_body += "\n".join(commit_info['commits_list']) - pr_body += f"\n\n**Latest commit:** [{commit_info['short_hash']}]({commit_info['repo_url']}/commit/{commit_info['current_commit']})" + pr_body += "\n\n*Note: Each commit in this PR contains references to the specific source code commits that triggered the documentation updates.*" subprocess.run([ "gh", "pr", "create", @@ -279,11 +295,28 @@ def main(): print("[Dry Run] Would push and open PR for the following files:") for f in modified_files: print(f"- {f}") + if commit_info: - print(f"\n[Dry Run] PR would include commit references from: {commit_info['repo_url']}") - print("[Dry Run] Source commits:") - for commit in commit_info['commits_list']: - print(f" {commit}") + # Show what the commit message would look like + commit_msg = "Auto-generated doc updates from code PR" + commit_msg += f"\n\nSource commits from {commit_info['repo_url'].split('/')[-1]}:" + for commit_line in commit_info['commits_list']: + if commit_line.startswith("- [") and "](" in commit_line: + start = commit_line.find("[") + 1 + end = commit_line.find("]") + hash_part = commit_line[start:end] + msg_start = commit_line.find(") ") + 2 + msg_part = commit_line[msg_start:] if msg_start > 1 else "" + commit_msg += f"\n- {hash_part}: {msg_part}" + commit_msg += f"\n\nLatest: {commit_info['short_hash']} - {commit_info['commit_message']}" + commit_msg += "\n\nAssisted-by: Gemini" + + print(f"\n[Dry Run] Commit message would be:") + print("=" * 50) + print(commit_msg) + print("=" * 50) + + print(f"\n[Dry Run] PR body would be simple (commit references are in commit message only)") else: push_and_open_pr(modified_files, commit_info) else: From 6ab494a1c528f94dff7198ede176cfb073b0010e Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 14:19:24 +0300 Subject: [PATCH 06/13] update --- ...udio.redhat.com_releaseserviceconfigs.yaml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/appstudio.redhat.com_releaseserviceconfigs.yaml b/config/crd/bases/appstudio.redhat.com_releaseserviceconfigs.yaml index 05770b496..d816fc7d7 100644 --- a/config/crd/bases/appstudio.redhat.com_releaseserviceconfigs.yaml +++ b/config/crd/bases/appstudio.redhat.com_releaseserviceconfigs.yaml @@ -16,11 +16,18 @@ spec: singular: releaseserviceconfig scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.debug + name: Debug + type: boolean + - jsonPath: .spec.logLevel + name: Log Level + type: string + name: v1alpha1 schema: openAPIV3Schema: description: ReleaseServiceConfig is the Schema for the releaseserviceconfigs - API + API. This resource manages global configuration settings for the release service. properties: apiVersion: description: |- @@ -71,6 +78,15 @@ spec: Debug is the boolean that specifies whether or not the Release Service should run in debug mode type: boolean + logLevel: + description: LogLevel defines the logging verbosity level for the release service + enum: + - trace + - debug + - info + - warn + - error + type: string defaultTimeouts: description: |- DefaultTimeouts contain the default Tekton timeouts to be used in case they are From 94edda3ee309da8516dd28e75ebe86a43d2b415b Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 14:33:05 +0300 Subject: [PATCH 07/13] update the commit msg --- scripts/suggest_docs.py | 72 ++++++++++------------------------------- 1 file changed, 17 insertions(+), 55 deletions(-) diff --git a/scripts/suggest_docs.py b/scripts/suggest_docs.py index b7e3e4a4a..f13fdc53b 100644 --- a/scripts/suggest_docs.py +++ b/scripts/suggest_docs.py @@ -41,37 +41,14 @@ def get_commit_info(): # Get commit message commit_msg = subprocess.run(["git", "log", "-1", "--pretty=format:%s", commit_hash], capture_output=True, text=True) - # Get commits in the range from main to HEAD - commits_log = subprocess.run(["git", "log", "--oneline", "origin/main...HEAD"], capture_output=True, text=True) - - if commits_log.returncode == 0 and commits_log.stdout.strip(): - # Multiple commits - commits = commits_log.stdout.strip().split('\n') - commit_list = [] - for commit_line in commits: - if commit_line.strip(): - parts = commit_line.split(' ', 1) - if len(parts) >= 2: - hash_part = parts[0] - msg_part = parts[1] - commit_list.append(f"- [{hash_part}]({repo_url}/commit/{hash_part}) {msg_part}") - - return { - 'repo_url': repo_url, - 'current_commit': commit_hash, - 'short_hash': short_hash, - 'commit_message': commit_msg.stdout.strip() if commit_msg.returncode == 0 else '', - 'commits_list': commit_list - } - else: - # Single commit or no commits - return { - 'repo_url': repo_url, - 'current_commit': commit_hash, - 'short_hash': short_hash, - 'commit_message': commit_msg.stdout.strip() if commit_msg.returncode == 0 else '', - 'commits_list': [f"- [{short_hash}]({repo_url}/commit/{commit_hash}) {commit_msg.stdout.strip() if commit_msg.returncode == 0 else ''}"] - } + # Just get the current commit that triggered the pipeline + return { + 'repo_url': repo_url, + 'current_commit': commit_hash, + 'short_hash': short_hash, + 'commit_message': commit_msg.stdout.strip() if commit_msg.returncode == 0 else '', + 'commits_list': [f"- [{short_hash}]({repo_url}/commit/{commit_hash}) {commit_msg.stdout.strip() if commit_msg.returncode == 0 else ''}"] + } except Exception as e: print(f"Warning: Could not get commit info: {e}") @@ -203,19 +180,10 @@ def push_and_open_pr(modified_files, commit_info=None): commit_msg = "Auto-generated doc updates from code PR" if commit_info: - commit_msg += f"\n\nSource commits from {commit_info['repo_url'].split('/')[-1]}:" - for commit_line in commit_info['commits_list']: - # Extract hash and message from markdown format - # Format: "- [hash](url) message" - if commit_line.startswith("- [") and "](" in commit_line: - start = commit_line.find("[") + 1 - end = commit_line.find("]") - hash_part = commit_line[start:end] - msg_start = commit_line.find(") ") + 2 - msg_part = commit_line[msg_start:] if msg_start > 1 else "" - commit_msg += f"\n- {hash_part}: {msg_part}" - - commit_msg += f"\n\nLatest: {commit_info['short_hash']} - {commit_info['commit_message']}" + repo_name = commit_info['repo_url'].split('/')[-1] + commit_msg += f"\n\nSource commit: {commit_info['short_hash']} from {repo_name}" + commit_msg += f"\nMessage: {commit_info['commit_message']}" + commit_msg += f"\nLink: {commit_info['repo_url']}/commit/{commit_info['current_commit']}" commit_msg += "\n\nAssisted-by: Gemini" @@ -298,17 +266,11 @@ def main(): if commit_info: # Show what the commit message would look like + repo_name = commit_info['repo_url'].split('/')[-1] commit_msg = "Auto-generated doc updates from code PR" - commit_msg += f"\n\nSource commits from {commit_info['repo_url'].split('/')[-1]}:" - for commit_line in commit_info['commits_list']: - if commit_line.startswith("- [") and "](" in commit_line: - start = commit_line.find("[") + 1 - end = commit_line.find("]") - hash_part = commit_line[start:end] - msg_start = commit_line.find(") ") + 2 - msg_part = commit_line[msg_start:] if msg_start > 1 else "" - commit_msg += f"\n- {hash_part}: {msg_part}" - commit_msg += f"\n\nLatest: {commit_info['short_hash']} - {commit_info['commit_message']}" + commit_msg += f"\n\nSource commit: {commit_info['short_hash']} from {repo_name}" + commit_msg += f"\nMessage: {commit_info['commit_message']}" + commit_msg += f"\nLink: {commit_info['repo_url']}/commit/{commit_info['current_commit']}" commit_msg += "\n\nAssisted-by: Gemini" print(f"\n[Dry Run] Commit message would be:") @@ -316,7 +278,7 @@ def main(): print(commit_msg) print("=" * 50) - print(f"\n[Dry Run] PR body would be simple (commit references are in commit message only)") + print(f"\n[Dry Run] PR body would be simple (commit reference is in commit message only)") else: push_and_open_pr(modified_files, commit_info) else: From c97589ad9cd84dc2165c2d699c089559fedd0893 Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 14:37:33 +0300 Subject: [PATCH 08/13] update --- .../bases/appstudio.redhat.com_releaseserviceconfigs.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/crd/bases/appstudio.redhat.com_releaseserviceconfigs.yaml b/config/crd/bases/appstudio.redhat.com_releaseserviceconfigs.yaml index d816fc7d7..03a26b988 100644 --- a/config/crd/bases/appstudio.redhat.com_releaseserviceconfigs.yaml +++ b/config/crd/bases/appstudio.redhat.com_releaseserviceconfigs.yaml @@ -87,6 +87,11 @@ spec: - warn - error type: string + retryAttempts: + description: RetryAttempts specifies the maximum number of retry attempts for failed pipeline runs + minimum: 0 + maximum: 10 + type: integer defaultTimeouts: description: |- DefaultTimeouts contain the default Tekton timeouts to be used in case they are From 0c1a74eadbec248667b78a704f5a5277ed35f9e7 Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 14:54:35 +0300 Subject: [PATCH 09/13] update to the commit msg --- scripts/suggest_docs.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/suggest_docs.py b/scripts/suggest_docs.py index f13fdc53b..d4ab4c0cd 100644 --- a/scripts/suggest_docs.py +++ b/scripts/suggest_docs.py @@ -17,10 +17,11 @@ def get_diff(): def get_commit_info(): """Get commit information for the documentation PR reference""" try: - # Get current commit hash - current_commit = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True) - if current_commit.returncode != 0: + # Get the HEAD commit - this is what GitHub Actions checked out for the PR + current_commit_result = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True) + if current_commit_result.returncode != 0: return None + commit_hash = current_commit_result.stdout.strip() # Get remote origin URL to construct proper commit links remote_url = subprocess.run(["git", "config", "--get", "remote.origin.url"], capture_output=True, text=True) @@ -35,10 +36,9 @@ def get_commit_info(): repo_url = repo_url.replace(".git", "") # Get commit details - commit_hash = current_commit.stdout.strip() short_hash = commit_hash[:7] - # Get commit message + # Get commit message for the same commit commit_msg = subprocess.run(["git", "log", "-1", "--pretty=format:%s", commit_hash], capture_output=True, text=True) # Just get the current commit that triggered the pipeline @@ -46,8 +46,7 @@ def get_commit_info(): 'repo_url': repo_url, 'current_commit': commit_hash, 'short_hash': short_hash, - 'commit_message': commit_msg.stdout.strip() if commit_msg.returncode == 0 else '', - 'commits_list': [f"- [{short_hash}]({repo_url}/commit/{commit_hash}) {commit_msg.stdout.strip() if commit_msg.returncode == 0 else ''}"] + 'commit_message': commit_msg.stdout.strip() if commit_msg.returncode == 0 else '' } except Exception as e: @@ -181,9 +180,10 @@ def push_and_open_pr(modified_files, commit_info=None): if commit_info: repo_name = commit_info['repo_url'].split('/')[-1] + commit_url = f"{commit_info['repo_url']}/commit/{commit_info['current_commit']}" commit_msg += f"\n\nSource commit: {commit_info['short_hash']} from {repo_name}" commit_msg += f"\nMessage: {commit_info['commit_message']}" - commit_msg += f"\nLink: {commit_info['repo_url']}/commit/{commit_info['current_commit']}" + commit_msg += f"\nLink: {commit_url}" commit_msg += "\n\nAssisted-by: Gemini" @@ -267,10 +267,11 @@ def main(): if commit_info: # Show what the commit message would look like repo_name = commit_info['repo_url'].split('/')[-1] + commit_url = f"{commit_info['repo_url']}/commit/{commit_info['current_commit']}" commit_msg = "Auto-generated doc updates from code PR" commit_msg += f"\n\nSource commit: {commit_info['short_hash']} from {repo_name}" commit_msg += f"\nMessage: {commit_info['commit_message']}" - commit_msg += f"\nLink: {commit_info['repo_url']}/commit/{commit_info['current_commit']}" + commit_msg += f"\nLink: {commit_url}" commit_msg += "\n\nAssisted-by: Gemini" print(f"\n[Dry Run] Commit message would be:") From d052640c905509d8fdca4672c0751e8e4a1fca5c Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 15:30:02 +0300 Subject: [PATCH 10/13] update --- .github/workflows/suggest_docs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/suggest_docs.yml b/.github/workflows/suggest_docs.yml index 5cac468df..4e701b6a6 100644 --- a/.github/workflows/suggest_docs.yml +++ b/.github/workflows/suggest_docs.yml @@ -3,6 +3,9 @@ name: Suggest Documentation Update (Enhanced) on: pull_request: types: [opened, synchronize] + paths-ignore: + - 'scripts/suggest_docs.py' + - '.github/workflows/suggest_docs.yml' workflow_dispatch: inputs: force_run: From 6da761dae47d0ad1144131dd26f86ee74869a4a9 Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 15:48:33 +0300 Subject: [PATCH 11/13] update --- .github/workflows/suggest_docs.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/suggest_docs.yml b/.github/workflows/suggest_docs.yml index 4e701b6a6..9ee5ca1fa 100644 --- a/.github/workflows/suggest_docs.yml +++ b/.github/workflows/suggest_docs.yml @@ -3,9 +3,6 @@ name: Suggest Documentation Update (Enhanced) on: pull_request: types: [opened, synchronize] - paths-ignore: - - 'scripts/suggest_docs.py' - - '.github/workflows/suggest_docs.yml' workflow_dispatch: inputs: force_run: @@ -53,4 +50,4 @@ jobs: DOCS_REPO_URL: ${{ secrets.DOCS_REPO_URL }} GH_TOKEN: ${{ secrets.GH_PAT }} run: | - python scripts/suggest_docs.py + python scripts/suggest_docs.py \ No newline at end of file From 3f50fee79367cfc015054dab7c2185de9358f537 Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 15:57:28 +0300 Subject: [PATCH 12/13] update --- scripts/suggest_docs.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/suggest_docs.py b/scripts/suggest_docs.py index d4ab4c0cd..e9919d287 100644 --- a/scripts/suggest_docs.py +++ b/scripts/suggest_docs.py @@ -38,15 +38,11 @@ def get_commit_info(): # Get commit details short_hash = commit_hash[:7] - # Get commit message for the same commit - commit_msg = subprocess.run(["git", "log", "-1", "--pretty=format:%s", commit_hash], capture_output=True, text=True) - # Just get the current commit that triggered the pipeline return { 'repo_url': repo_url, 'current_commit': commit_hash, - 'short_hash': short_hash, - 'commit_message': commit_msg.stdout.strip() if commit_msg.returncode == 0 else '' + 'short_hash': short_hash } except Exception as e: @@ -182,7 +178,6 @@ def push_and_open_pr(modified_files, commit_info=None): repo_name = commit_info['repo_url'].split('/')[-1] commit_url = f"{commit_info['repo_url']}/commit/{commit_info['current_commit']}" commit_msg += f"\n\nSource commit: {commit_info['short_hash']} from {repo_name}" - commit_msg += f"\nMessage: {commit_info['commit_message']}" commit_msg += f"\nLink: {commit_url}" commit_msg += "\n\nAssisted-by: Gemini" @@ -225,7 +220,7 @@ def main(): commit_info = get_commit_info() if commit_info: print(f"Source repository: {commit_info['repo_url']}") - print(f"Latest commit: {commit_info['short_hash']} - {commit_info['commit_message']}") + print(f"Latest commit: {commit_info['short_hash']}") clone_docs_repo() previews = get_file_previews() @@ -270,7 +265,6 @@ def main(): commit_url = f"{commit_info['repo_url']}/commit/{commit_info['current_commit']}" commit_msg = "Auto-generated doc updates from code PR" commit_msg += f"\n\nSource commit: {commit_info['short_hash']} from {repo_name}" - commit_msg += f"\nMessage: {commit_info['commit_message']}" commit_msg += f"\nLink: {commit_url}" commit_msg += "\n\nAssisted-by: Gemini" From c8eb274361a9e4af53d0ba1bcd4933e733fb29b7 Mon Sep 17 00:00:00 2001 From: csoceanu Date: Mon, 18 Aug 2025 16:02:50 +0300 Subject: [PATCH 13/13] update --- config/crd/bases/appstudio.redhat.com_releaseplans.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/crd/bases/appstudio.redhat.com_releaseplans.yaml b/config/crd/bases/appstudio.redhat.com_releaseplans.yaml index 23825ffd1..6d5af1a4e 100644 --- a/config/crd/bases/appstudio.redhat.com_releaseplans.yaml +++ b/config/crd/bases/appstudio.redhat.com_releaseplans.yaml @@ -27,7 +27,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: ReleasePlan is the Schema for the ReleasePlans API. This resource defines release configurations for applications. + description: ReleasePlan is the Schema for the ReleasePlans API. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation