Skip to content

Tagging workflow included - #57

Merged
susrisha merged 2 commits into
masterfrom
task-3739
Jun 11, 2026
Merged

Tagging workflow included#57
susrisha merged 2 commits into
masterfrom
task-3739

Conversation

@susrisha

@susrisha susrisha commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Adding another workflow as part of https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3739
This workflow automatically updates the tags based on merges to the respective branches

Changes

Added a new GitHub Actions workflow (.github/workflows/tag.yml) that automatically updates environment tags when pull requests are merged.

Workflow Details:

  • Trigger: Pull request closure events on develop, staging, and production branches (only executes when PR is merged)
  • Tag Mapping: Maps base branch to environment tag:
    • developdev
    • stagingstage
    • productionprod
  • Execution: Force-updates the git tag locally and pushes it to the remote repository with the --force flag
  • Permissions: Requires contents: write to push tags

The workflow enables automated environment tagging aligned with branch-based deployments, ensuring consistent tag versions across environments.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@susrisha, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 47 seconds. Learn how PR review limits work.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c7fd8748-9f3c-4595-b53d-618be3f04014

📥 Commits

Reviewing files that changed from the base of the PR and between dfe2d57 and 9165bfa.

📒 Files selected for processing (1)
  • .github/workflows/tag.yml
📝 Walkthrough

Walkthrough

A new GitHub Actions workflow automatically tags the repository whenever pull requests merge to develop, staging, or production branches. The workflow determines the environment from the PR base branch, creates or updates a corresponding git tag (dev, stage, or prod), and pushes it to the remote.

Changes

Environment Tag Automation

Layer / File(s) Summary
Environment tag automation workflow
.github/workflows/tag.yml
Complete GitHub Actions workflow triggered on merged PRs that computes environment-specific tag names from PR base branches and force-pushes corresponding git tags to the remote repository.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through CI flows,
Tags now bloom where PRs close,
Dev, stage, prod—all clearly marked,
Environments identified, never in the dark! ✨

🚥 Pre-merge checks | ✅ 5
✅ 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 'Tagging workflow included' directly relates to the main change, which is the addition of a new GitHub Actions tagging workflow file that automatically updates environment tags.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

@susrisha
susrisha requested a review from MashB June 11, 2026 05:36

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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/tag.yml (1)

24-24: ⚡ Quick win

Avoid template expansion in shell script context.

Directly expanding ${{ github.event.pull_request.base.ref }} into a shell script violates secure coding practices. While the branch filter mitigates injection risk here, passing the value via an environment variable is safer and clearer.

♻️ Proposed refactor to use environment variable
         - name: Get the current branch name
           id: get_branch
+          env:
+            TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
           run: |
-            TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
-            
             if [ "$TARGET_BRANCH" = "develop" ]; then
                 echo "ENV_TAG=dev" >> $GITHUB_ENV
             elif [ "$TARGET_BRANCH" = "staging" ]; then
                 echo "ENV_TAG=stage" >> $GITHUB_ENV
             elif [ "$TARGET_BRANCH" = "production" ]; then
                 echo "ENV_TAG=prod" >> $GITHUB_ENV
+            else
+                echo "Error: Unknown branch $TARGET_BRANCH" >&2
+                exit 1
             fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/tag.yml at line 24, Replace direct template expansion
inside the shell script by assigning the pull request base ref to an environment
variable and then using that env var in the script: stop using
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}" inline and instead add
an env mapping (e.g., env: TARGET_BRANCH: ${{ github.event.pull_request.base.ref
}}) at the job/step level and reference $TARGET_BRANCH in the script; update any
occurrences of TARGET_BRANCH in the workflow script to read from the environment
rather than expanding the GitHub Actions template directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/tag.yml:
- Around line 21-32: The get_branch step sets ENV_TAG based on TARGET_BRANCH but
lacks an else and validation; update the step that defines TARGET_BRANCH/ENV_TAG
to add an else branch that fails with a clear message if TARGET_BRANCH is
unexpected, and after the if/elif/else ensure you validate ENV_TAG is non-empty
(exit non-zero and echo a helpful error referencing ENV_TAG and TARGET_BRANCH)
before any later use (e.g., the git tag -f action) so the workflow fails fast
with a clear diagnostic.

---

Nitpick comments:
In @.github/workflows/tag.yml:
- Line 24: Replace direct template expansion inside the shell script by
assigning the pull request base ref to an environment variable and then using
that env var in the script: stop using TARGET_BRANCH="${{
github.event.pull_request.base.ref }}" inline and instead add an env mapping
(e.g., env: TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}) at the
job/step level and reference $TARGET_BRANCH in the script; update any
occurrences of TARGET_BRANCH in the workflow script to read from the environment
rather than expanding the GitHub Actions template directly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 689debc3-afda-4a21-94b8-7afafa74cccf

📥 Commits

Reviewing files that changed from the base of the PR and between ddf47b2 and dfe2d57.

📒 Files selected for processing (1)
  • .github/workflows/tag.yml

Comment thread .github/workflows/tag.yml
@susrisha
susrisha merged commit eef9cc9 into master Jun 11, 2026
1 of 2 checks passed
@susrisha
susrisha deleted the task-3739 branch June 11, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants