An open API service indexing awesome lists of open source software.

https://github.com/stillpoint-software/shared-workflows

Shared workflows to run from other respositories
https://github.com/stillpoint-software/shared-workflows

Last synced: 3 months ago
JSON representation

Shared workflows to run from other respositories

Awesome Lists containing this project

README

          

# ๐ŸŒ Shared Workflows Repository

This repository contains reusable **GitHub Actions workflows** for .NET projects.
By centralizing the workflow logic here, all consumer repositories can use the same CI/CD standards without duplicating configuration.

---

## ๐Ÿ“‘ Table of Contents

- [๐ŸŒ Shared Workflows Repository](#-shared-workflows-repository)
- [๐Ÿ“‘ Table of Contents](#-table-of-contents)
- [๐Ÿ“Œ Available Workflows](#-available-workflows)
- [1. โœ… Format](#1--format)
- [2. ๐Ÿงช Test](#2--test)
- [Prerequisites:](#prerequisites)
- [3. ๐Ÿ“Š Test Report](#3--test-report)
- [4. ๐ŸŒฟ Create Issue Branch](#4--create-issue-branch)

---

## ๐Ÿ“Œ Available Workflows

### 1. โœ… Format

Automatically formats C# code using `dotnet format`.
Commits any changes back to the repository.

**Consumer Usage**

```yaml
name: Format

on:
push:
workflow_run:
workflows:
- Create Prerelease
- Create Release
types: [requested]
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize, reopened]
branches:
- main
- develop

jobs:
format:
uses: Stillpoint-Software/shared-workflows/.github/workflows/format.yml@main
with:
dotnet_version: "9.0.x"
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
```

### 2. ๐Ÿงช Test

Builds and tests the solution.
Uploads .trx test results as artifacts.

##### Prerequisites:
Add a repository variable for the solution file:
1. Go to Respository Settings
2. Go to Actions โ†’ Variables
3. Enter the following:
- Key: SOLUTION_NAME
- Value: MyProject.sln

**Consumer Usage**
```yaml
name: Test

on:
workflow_run:
workflows:
- Create Prerelease
- Create Release
types: [requested]
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize, reopened]
branches:
- main
- develop

jobs:
test:
uses: Stillpoint-Software/shared-workflows/.github/workflows/test.yml@main
with:
dotnet_version: "9.0.x"
solution_name: ${{ vars.SOLUTION_NAME }}
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
```
### 3. ๐Ÿ“Š Test Report

Generates a GitHub Checks report from test results.
Triggered after the Test workflow completes.

**Consumer Usage**

```yaml
name: Test Report
run-name: Generate Test Report for workflow ${{ github.event.workflow_run.name }} run ${{ github.event.workflow_run.run_number }} branch ${{ github.event.workflow_run.head_branch }}

on:
workflow_run:
workflows: [ "Test" ]
types:
- completed

permissions:
contents: read
actions: read
checks: write

jobs:
report:
uses: Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@main
with:
artifact_name: "test-results"
test_report_name: "Unit Tests"
path: "*.trx"
```

### 4. ๐ŸŒฟ Create Issue Branch
Automatically creates a new branch when issues or PRs are opened, assigned, or commented on.

**Consumer Usage**

```yaml
name: Create Issue Branch

on:
issues:
types: [ opened, assigned ]
issue_comment:
types: [ created ]
pull_request:
types: [ opened, closed ]

jobs:
create_issue_branch_job:
uses: Stillpoint-Software/shared-workflows/.github/workflows/create-issue-branch.yml@main
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

๐Ÿ”‘ Why Shared Workflows?
- Centralized logic โ€” update once, use everywhere
- Consumer flexibility โ€” each repo controls when to run
- Consistency โ€” all repos follow the same CI/CD rules
- Scalable โ€” easy to add new workflows in one place

๐Ÿš€ Quick Tips
- Set GH_TOKEN in your consumer repos to allow commits and PR updates.
- Use vars.SOLUTION_NAME instead of hardcoding solution names.
- You can chain workflows in a consumer repo by adding:

```yaml
needs: format
```