Skip to content

Add reusable automation templates#797

Merged
Bryan-Roe merged 4 commits intomainfrom
codex/create-reusable-automation-templates
Aug 6, 2025
Merged

Add reusable automation templates#797
Bryan-Roe merged 4 commits intomainfrom
codex/create-reusable-automation-templates

Conversation

@Bryan-Roe
Copy link
Collaborator

@Bryan-Roe Bryan-Roe commented Jul 27, 2025

Summary

  • add reusable GitHub Actions templates for build, test and deploy
  • document templates in new REUSABLE_AUTOMATION_TEMPLATES.md
  • reference templates in README project structure and contribution section

Testing

  • pytest -q (fails: ModuleNotFoundError: No module named 'watchdog')

https://chatgpt.com/codex/tasks/task_e_6886a74486cc8322b58c543ba0b7873a

Summary by Sourcery

Introduce reusable GitHub Actions templates for build, test, and deploy pipelines and update documentation to guide their usage

New Features:

  • Add reusable build workflow template supporting .NET, Python, and Node
  • Add reusable test workflow template supporting .NET, Python, and Node
  • Add reusable deploy workflow template for building Docker images and deploying to Azure App Service

Documentation:

  • Add REUSABLE_AUTOMATION_TEMPLATES.md documenting usage of new templates
  • Update README to reference the templates directory and documentation

Copilot AI review requested due to automatic review settings July 27, 2025 22:50
@sourcery-ai
Copy link

sourcery-ai bot commented Jul 27, 2025

Reviewer's Guide

This PR introduces a set of parameterized, reusable GitHub Actions workflows for build, test, and deploy tasks, adds dedicated documentation for these templates, and updates the project README to reference the new templates directory and usage guide.

Flow diagram for build.yml reusable workflow logic

flowchart TD
  Start([Start]) --> Checkout[Checkout code]
  Checkout --> CheckDotnet{dotnet input?}
  CheckDotnet -- Yes --> SetupDotnet[Setup .NET]
  SetupDotnet --> BuildDotnet[Build .NET project]
  CheckDotnet -- No --> CheckPython{python input?}
  BuildDotnet --> CheckPython
  CheckPython -- Yes --> SetupPython[Setup Python]
  SetupPython --> InstallPyDeps[Install Python dependencies]
  InstallPyDeps --> BuildPyWheel[Build Python wheel]
  BuildPyWheel --> CheckNode{node input?}
  CheckPython -- No --> CheckNode
  CheckNode -- Yes --> SetupNode[Setup Node]
  SetupNode --> InstallNodeDeps[Install Node dependencies]
  InstallNodeDeps --> BuildNode[Build Node package]
  BuildNode --> End([End])
  CheckNode -- No --> End
Loading

Flow diagram for deploy.yml reusable workflow logic

flowchart TD
  Start([Start]) --> Checkout[Checkout code]
  Checkout --> CheckRegistry{registry input?}
  CheckRegistry -- Yes --> LoginRegistry[Log in to registry]
  LoginRegistry --> BuildPush[Build and push Docker image]
  CheckRegistry -- No --> BuildPush
  BuildPush --> DeployAzure[Deploy to Azure Web App]
  DeployAzure --> End([End])
Loading

File-Level Changes

Change Details Files
Introduce reusable CI/CD workflow templates
  • Add build.yml, test.yml, deploy.yml under .github/workflows/templates
  • Use workflow_call with inputs to toggle .NET, Python, and Node steps
  • Include conditional setup, install, execute, and deployment steps
  • Inherit repository secrets for cross-template consistency
.github/workflows/templates/build.yml
.github/workflows/templates/test.yml
.github/workflows/templates/deploy.yml
Add standalone documentation for automation templates
  • Create REUSABLE_AUTOMATION_TEMPLATES.md in docs directory
  • Describe available templates and their parameters
  • Provide usage examples for composing workflows
docs/REUSABLE_AUTOMATION_TEMPLATES.md
Update README to surface new templates and guide
  • Add .github/workflows/templates/ entry to project structure
  • Link to Reusable Automation Templates doc in Contributing section
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Bryan-Roe - I've reviewed your changes - here's some feedback:

  • Add caching steps (e.g., actions/cache) for NuGet, pip, and npm dependencies in the build/test templates to speed up CI runs.
  • Parameterize the project directory paths as inputs so the templates can be reused in repos with different structures without modification.
  • Update the Docker build/push step to include a slash between registry and image name (e.g., ${{ inputs.registry }}/${{ inputs.image_name }}) to avoid invalid image tags.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add caching steps (e.g., actions/cache) for NuGet, pip, and npm dependencies in the build/test templates to speed up CI runs.
- Parameterize the project directory paths as inputs so the templates can be reused in repos with different structures without modification.
- Update the Docker build/push step to include a slash between registry and image name (e.g., `${{ inputs.registry }}/${{ inputs.image_name }}`) to avoid invalid image tags.

## Individual Comments

### Comment 1
<location> `.github/workflows/templates/deploy.yml:25` </location>
<code_context>
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Build and push image
+        run: |
+          docker build -t ${{ inputs.registry }}${{ inputs.image_name }}:${{ inputs.tag }} .
</code_context>

<issue_to_address>
Image tag construction may result in invalid image names if 'registry' input is empty.

Normalize 'inputs.registry' to ensure it ends with a slash, or handle cases where it does not, to prevent invalid image names.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

Copilot AI left a 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 adds reusable GitHub Actions workflow templates to streamline CI/CD operations across the project. The templates support build, test, and deployment automation for .NET, Python, and Node.js projects.

  • Added three reusable workflow templates (build.yml, test.yml, deploy.yml) with configurable language support
  • Created comprehensive documentation explaining template usage and examples
  • Updated project structure documentation to reference the new automation templates

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/REUSABLE_AUTOMATION_TEMPLATES.md Documentation for the new reusable workflow templates with usage examples
README.md Updated project structure and contribution sections to reference automation templates
.github/workflows/templates/test.yml Reusable test workflow supporting .NET, Python, and Node.js projects
.github/workflows/templates/deploy.yml Reusable deployment workflow for Docker images to Azure App Service
.github/workflows/templates/build.yml Reusable build workflow supporting multiple language ecosystems

Bryan-Roe and others added 3 commits July 30, 2025 16:32
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Bryan <74067792+Bryan-Roe@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Bryan <74067792+Bryan-Roe@users.noreply.github.com>
Signed-off-by: Bryan <74067792+Bryan-Roe@users.noreply.github.com>
@Bryan-Roe Bryan-Roe merged commit 0667f07 into main Aug 6, 2025
7 of 11 checks passed
@Bryan-Roe Bryan-Roe deleted the codex/create-reusable-automation-templates branch August 6, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant