Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/sync-automated-style-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Sync Automated Style Validation

on:
push:
branches:
- master
paths:
- 'automated-style-validation/**'
- '.github/workflows/sync-automated-style-validation.yml'
workflow_dispatch:

jobs:
sync:
runs-on: ubuntu-latest
strategy:
matrix:
repo:
- OutSystems/docs-next
- OutSystems/training-internal
- OutSystems/docs-support-internal
- OutSystems/docs-product-internal
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout source repo
uses: actions/checkout@v4
with:
path: source-repo

- name: Generate branch name with UUID
id: branch
run: echo "name=sync/automated-style-validation-$(uuidgen)" >> $GITHUB_OUTPUT

- name: Checkout target repo
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
token: ${{ secrets.TOOLS_PAT }}
path: target-repo

- name: Detect default branch
id: base-branch
run: |
cd target-repo
default_branch=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
echo "base=$default_branch" >> $GITHUB_OUTPUT
cd ..

- name: Sync automated-style-validation contents to target repo root
run: rsync -av source-repo/automated-style-validation/ target-repo/

- name: Create Pull Request in target repo
uses: peter-evans/create-pull-request@v7
with:
path: target-repo
base: ${{ steps.base-branch.outputs.base }}
commit-message: "Sync automated-style-validation changes"
branch: ${{ steps.branch.outputs.name }}
title: "Sync automated-style-validation"
body: "This PR syncs changes on style validation files."
labels: |
skip-jira
auto-merge
token: ${{ secrets.TOOLS_PAT }}
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,68 @@ Do the following:

1. Zip contents of `styles-vale/OutSystems` into `OutSystems.zip`. Attach `OutSystems.zip` as binary file to release.

1. Publish the release to make it public.
1. Publish the release to make it public.

## Automated Style Validation

This repository provides a reusable GitHub Actions workflow for running style validation (e.g., `markdownlint`) across multiple repositories.
Follow the steps below to enable and maintain validation checks in your target repositories.

---

### 1. Start Using Automated Validation in a New Repository

#### Step 1 — Register the Repository

Update the `.github/workflows/sync-automated-style-validation.yml` file in this repository and add the new repository name to the matrix.
Example:

```yaml
matrix:
repo:
- OutSystems/training-internal
- OutSystems/my-new-repo # ← Add here
```

Commit and merge the changes to `main`.
Once merged, the configuration files will automatically be synced into the target repository.

---

### Step 2 — Add the Workflow to the Target Repository

In the target repository, create (or update) a workflow to call the reusable style validation workflow.
For example, add the following to `.github/workflows/pr-style-validation.yml`:

```yaml
name: PR Style Validation Checks

on:
pull_request:

jobs:
call-markdownlint:
uses: OutSystems/tk-cicd/.github/workflows/style-guides-validation.yml@main

secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
```

👉 Place this workflow in the stage of your pipeline where it makes the most sense (e.g., alongside linting or testing jobs).

---

### 2. Updating the Validation Rules

To change the validation rules:

1. Update the `.markdownlint.json` file in this repository with the necessary changes.
2. Open and merge a PR into `main`.
3. Once merged, the updated rules will automatically propagate (mirrored) across all dependent repositories.

---

### Summary

- **Add new repos**: update the `matrix.repo` in `sync-automated-style-validation.yml` and add a workflow to the target repo.
- **Update rules**: edit `.markdownlint.json` in this repo, merge to `main`, and changes will sync everywhere.
2 changes: 1 addition & 1 deletion automated-style-validation/.markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"default": false,
"MD001": true
}
}