From 5d4b295d070c91c982faf5831a4dcb4863358264 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 16:51:43 +0000 Subject: [PATCH 1/4] Initial plan From 0bb7a2984859876aa1a91f6dc076c677c15b1098 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 16:52:45 +0000 Subject: [PATCH 2/4] refactor: replace git-flow workflow with direct feature/component-release push Agent-Logs-Url: https://github.com/rdkcentral/sysint/sessions/8bf009fe-8528-4cd9-9c28-143853dabc1a Co-authored-by: yogeswaransky <166126056+yogeswaransky@users.noreply.github.com> --- .github/workflows/component-release.yml | 100 ++++++++++-------------- 1 file changed, 40 insertions(+), 60 deletions(-) diff --git a/.github/workflows/component-release.yml b/.github/workflows/component-release.yml index d35b48e9..5e197952 100644 --- a/.github/workflows/component-release.yml +++ b/.github/workflows/component-release.yml @@ -23,102 +23,82 @@ jobs: exit 1 fi echo "Validation passed: version field found." + release: if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Checkout feature/component-release uses: actions/checkout@v3 + with: + ref: feature/component-release + fetch-depth: 0 - name: Set up Git run: | - git config --global user.name "GitHub Actions" - git config --global user.email "187267378+rdkcm-rdke@users.noreply.github.com" + git config user.name "GitHub Actions" + git config user.email "187267378+rdkcm-rdke@users.noreply.github.com" - - name: Install git-flow and auto-changelog - run: | - sudo apt-get update - sudo apt-get install -y git-flow - npm install -g auto-changelog + - name: Install auto-changelog + run: npm install -g auto-changelog - - name: Clone the project and start release + - name: Calculate version, update changelog, tag and push + env: + PR_DESC: ${{ github.event.pull_request.body }} run: | set -e - git clone https://x-access-token:${{ secrets.RDKCM_RDKE }}@github.com/${{ github.repository }} project - cd project - git fetch --all - git checkout main || git checkout -b main origin/main - git checkout develop || git checkout -b develop origin/develop - - git config gitflow.branch.master main - git config gitflow.branch.develop develop - git config gitflow.prefix.feature feature/ - git config gitflow.prefix.bugfix bugfix/ - git config gitflow.prefix.release release/ - git config gitflow.prefix.hotfix hotfix/ - git config gitflow.prefix.support support/ - git config gitflow.prefix.versiontag '' - - echo "git config completed" - # Extract version from PR description - PR_DESC="${{ github.event.pull_request.body }}" - # Get top tag from CHANGELOG.md + + # Extract top tag from CHANGELOG.md TOP_TAG=$(grep -m 1 -oP '^#### \[\K[^\]]+' CHANGELOG.md) if [[ -z "$TOP_TAG" ]]; then echo "No version found in CHANGELOG.md!" exit 1 fi - # Validate TOP_TAG format (semantic versioning: major.minor.patch) if [[ ! "$TOP_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Invalid version format in CHANGELOG.md: $TOP_TAG. Expected format: major.minor.patch" + echo "Invalid version format in CHANGELOG.md: $TOP_TAG" exit 1 fi + IFS='.' read -r major minor patch <<< "$TOP_TAG" VERSION_TYPE=$(echo "$PR_DESC" | grep -oiP 'version\s*:\s*\K(major|minor|patch)' | tr '[:upper:]' '[:lower:]') - if [[ -z "$VERSION_TYPE" ]]; then - echo "No version type found in PR description, defaulting to PATCH increment." - patch=$((patch + 1)) - elif [[ "$VERSION_TYPE" == "major" ]]; then - major=$((major + 1)) - minor=0 - patch=0 + + if [[ "$VERSION_TYPE" == "major" ]]; then + major=$((major + 1)); minor=0; patch=0 elif [[ "$VERSION_TYPE" == "minor" ]]; then - minor=$((minor + 1)) - patch=0 - elif [[ "$VERSION_TYPE" == "patch" ]]; then - patch=$((patch + 1)) + minor=$((minor + 1)); patch=0 else - echo "Invalid version type in PR description: $VERSION_TYPE" - exit 1 + patch=$((patch + 1)) fi + RELEASE_VERSION="$major.$minor.$patch" - echo "Using calculated version: $RELEASE_VERSION" - echo "RELEASE_VERSION=$RELEASE_VERSION" + echo "Calculated version: $RELEASE_VERSION" echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + # Check if tag already exists if git rev-parse "refs/tags/$RELEASE_VERSION" >/dev/null 2>&1; then - echo "Tag $RELEASE_VERSION already exists. Skipping release." + echo "Tag $RELEASE_VERSION already exists. Skipping." exit 0 fi - git flow release start $RELEASE_VERSION - auto-changelog -v $RELEASE_VERSION + + # Generate changelog and commit on feature/component-release + auto-changelog -v "$RELEASE_VERSION" git add CHANGELOG.md git commit -m "$RELEASE_VERSION release changelog updates" - git flow release publish - - name: Finish release and push (default git-flow messages) - run: | - set -e - cd project - git flow release finish -m "$RELEASE_VERSION release" $RELEASE_VERSION - git push origin main + # Tag the commit + git tag -a "$RELEASE_VERSION" -m "$RELEASE_VERSION release" + + # Push the commit and tag to feature/component-release only + git push origin feature/component-release git push origin --tags - git push origin develop - + - name: Cleanup tag if workflow fails if: failure() run: | - cd project - git tag -d $RELEASE_VERSION || true - git push origin :refs/tags/$RELEASE_VERSION || true + if [ -n "$RELEASE_VERSION" ]; then + git tag -d "$RELEASE_VERSION" || true + git push origin ":refs/tags/$RELEASE_VERSION" || true + else + echo "RELEASE_VERSION not set, skipping cleanup." + fi From 02ecc1823f1b5b4f01b6f4cd2c1d25f2042fbcda Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 16:53:19 +0000 Subject: [PATCH 3/4] fix: use env context for RELEASE_VERSION in cleanup step Agent-Logs-Url: https://github.com/rdkcentral/sysint/sessions/8bf009fe-8528-4cd9-9c28-143853dabc1a Co-authored-by: yogeswaransky <166126056+yogeswaransky@users.noreply.github.com> --- .github/workflows/component-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/component-release.yml b/.github/workflows/component-release.yml index 5e197952..136e55a1 100644 --- a/.github/workflows/component-release.yml +++ b/.github/workflows/component-release.yml @@ -95,6 +95,8 @@ jobs: - name: Cleanup tag if workflow fails if: failure() + env: + RELEASE_VERSION: ${{ env.RELEASE_VERSION }} run: | if [ -n "$RELEASE_VERSION" ]; then git tag -d "$RELEASE_VERSION" || true From fe8200ca102ec608d1cf6c7f4e128e6dcabad6ef Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 16:59:58 +0000 Subject: [PATCH 4/4] restore git-flow workflow targeting feature/component-release, fix auth and shell injection Agent-Logs-Url: https://github.com/rdkcentral/sysint/sessions/050a584a-0da6-4e4c-8cd5-035fba1be6d2 Co-authored-by: yogeswaransky <166126056+yogeswaransky@users.noreply.github.com> --- .github/workflows/component-release.yml | 44 ++++++++++++++++++------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/component-release.yml b/.github/workflows/component-release.yml index 136e55a1..a01b5d07 100644 --- a/.github/workflows/component-release.yml +++ b/.github/workflows/component-release.yml @@ -40,15 +40,28 @@ jobs: git config user.name "GitHub Actions" git config user.email "187267378+rdkcm-rdke@users.noreply.github.com" - - name: Install auto-changelog - run: npm install -g auto-changelog + - name: Install git-flow and auto-changelog + run: | + sudo apt-get update + sudo apt-get install -y git-flow + npm install -g auto-changelog - - name: Calculate version, update changelog, tag and push + - name: Start release, generate changelog and publish env: PR_DESC: ${{ github.event.pull_request.body }} run: | set -e + # Configure git-flow to use feature/component-release as both master and develop + git config gitflow.branch.master feature/component-release + git config gitflow.branch.develop feature/component-release + git config gitflow.prefix.feature feature/ + git config gitflow.prefix.bugfix bugfix/ + git config gitflow.prefix.release release/ + git config gitflow.prefix.hotfix hotfix/ + git config gitflow.prefix.support support/ + git config gitflow.prefix.versiontag '' + # Extract top tag from CHANGELOG.md TOP_TAG=$(grep -m 1 -oP '^#### \[\K[^\]]+' CHANGELOG.md) if [[ -z "$TOP_TAG" ]]; then @@ -63,33 +76,40 @@ jobs: IFS='.' read -r major minor patch <<< "$TOP_TAG" VERSION_TYPE=$(echo "$PR_DESC" | grep -oiP 'version\s*:\s*\K(major|minor|patch)' | tr '[:upper:]' '[:lower:]') - if [[ "$VERSION_TYPE" == "major" ]]; then + if [[ -z "$VERSION_TYPE" ]]; then + echo "No version type found in PR description, defaulting to PATCH increment." + patch=$((patch + 1)) + elif [[ "$VERSION_TYPE" == "major" ]]; then major=$((major + 1)); minor=0; patch=0 elif [[ "$VERSION_TYPE" == "minor" ]]; then minor=$((minor + 1)); patch=0 - else + elif [[ "$VERSION_TYPE" == "patch" ]]; then patch=$((patch + 1)) + else + echo "Invalid version type in PR description: $VERSION_TYPE" + exit 1 fi RELEASE_VERSION="$major.$minor.$patch" - echo "Calculated version: $RELEASE_VERSION" + echo "Using calculated version: $RELEASE_VERSION" echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV # Check if tag already exists if git rev-parse "refs/tags/$RELEASE_VERSION" >/dev/null 2>&1; then - echo "Tag $RELEASE_VERSION already exists. Skipping." + echo "Tag $RELEASE_VERSION already exists. Skipping release." exit 0 fi - # Generate changelog and commit on feature/component-release + git flow release start "$RELEASE_VERSION" auto-changelog -v "$RELEASE_VERSION" git add CHANGELOG.md git commit -m "$RELEASE_VERSION release changelog updates" + git flow release publish - # Tag the commit - git tag -a "$RELEASE_VERSION" -m "$RELEASE_VERSION release" - - # Push the commit and tag to feature/component-release only + - name: Finish release and push + run: | + set -e + git flow release finish -m "$RELEASE_VERSION release" "$RELEASE_VERSION" git push origin feature/component-release git push origin --tags