https://github.com/ka1ne/harness-template-diff
GitHub Action that aids reviews for Harness template changes, providing semantic version diffs and formatted PR comments for easier code review.
https://github.com/ka1ne/harness-template-diff
automation code-review devops github-actions harness template-management version-control
Last synced: 11 months ago
JSON representation
GitHub Action that aids reviews for Harness template changes, providing semantic version diffs and formatted PR comments for easier code review.
- Host: GitHub
- URL: https://github.com/ka1ne/harness-template-diff
- Owner: ka1ne
- License: mit
- Created: 2025-02-17T10:33:26.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-02-17T12:28:48.000Z (11 months ago)
- Last Synced: 2025-02-17T13:30:27.893Z (11 months ago)
- Topics: automation, code-review, devops, github-actions, harness, template-management, version-control
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Harness Template Diff Action ๐
A GitHub Action that automatically detects and reviews Harness template version changes in pull requests. It generates clear diffs and posts formatted review comments to help maintainers review template changes effectively.
## Overview
When templates are modified in a pull request, this action:
- Detects template version changes
- Compares versions using semantic versioning
- Generates formatted diffs
- Posts clear review comments
- Provides helpful guidelines and resources
## Setup
Add this workflow to your repository at `.github/workflows/template-review.yml`:
name: Template Review
on:
pull_request:
paths:
- '.harness/templates/**'
jobs:
review:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Configure Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git config --global --add safe.directory /github/workspace
- name: Run Template Diff
uses: ka1ne/harness-template-diff-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_CONTEXT: ${{ toJSON(github) }}
## Template Requirements
Templates must follow this structure:
.harness/templates/
TemplateName/
v0.1.0.yaml
v0.2.0.yaml
...
### Rules
- Files must use semantic versioning: `vX.Y.Z.yaml`
- Each template needs its own directory
- Version numbers should follow semver guidelines:
- MAJOR: Breaking changes
- MINOR: New features, backward compatible
- PATCH: Bug fixes, backward compatible
## Example Output
When changes are detected, the action posts a comment like this:
# ๐ Template Review Required
### โ ๏ธ 1 template modification detected
## ๐ฆ Template: `MyTemplate`
### ๐ Version Update: `v0.1.0` โ `v0.2.0`
> ### ๐ Review Changes
ย ย ย ย ๐ Click to expand diff โคต๏ธ
- old version content
+ new version content
## Required Permissions
The action needs:
- `pull-requests: write` permission in the workflow
- `GITHUB_TOKEN` for API access
- Git configuration for workspace access
## Development
To contribute:
1. Clone the repository
2. Make your changes
3. Test locally using: `python generate_template_diff.py`
4. Submit a PR with your changes
## License
MIT License - see LICENSE file for details