From 5901f7fbc024d7af9c19d7cddae882928a8d1c13 Mon Sep 17 00:00:00 2001 From: Miguel Guerreiro Date: Thu, 25 Sep 2025 14:22:17 +0100 Subject: [PATCH 1/5] TK-18348: Add configuration file --- automated-style-validation/.markdownlint.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 automated-style-validation/.markdownlint.json diff --git a/automated-style-validation/.markdownlint.json b/automated-style-validation/.markdownlint.json new file mode 100644 index 0000000..cc029f3 --- /dev/null +++ b/automated-style-validation/.markdownlint.json @@ -0,0 +1,4 @@ +{ + "default": false, + "MD001": true +} \ No newline at end of file From 85b6fe1da15e6497b62ead6cc34a918a4ea2a87a Mon Sep 17 00:00:00 2001 From: MiguelG28 Date: Fri, 26 Sep 2025 12:18:08 +0100 Subject: [PATCH 2/5] Tk 18349 create GitHub workflow to push files changed (#20) * TK-18349: Create GitHub workflow to push changed files to the target repos --- .../sync-automated-style-validation.yml | 66 +++++++++++++++++++ README.md | 66 ++++++++++++++++++- automated-style-validation/.markdownlint.json | 2 +- 3 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/sync-automated-style-validation.yml diff --git a/.github/workflows/sync-automated-style-validation.yml b/.github/workflows/sync-automated-style-validation.yml new file mode 100644 index 0000000..f63619a --- /dev/null +++ b/.github/workflows/sync-automated-style-validation.yml @@ -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 }} diff --git a/README.md b/README.md index 1c21789..a231b9f 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +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. diff --git a/automated-style-validation/.markdownlint.json b/automated-style-validation/.markdownlint.json index cc029f3..25b7122 100644 --- a/automated-style-validation/.markdownlint.json +++ b/automated-style-validation/.markdownlint.json @@ -1,4 +1,4 @@ { "default": false, "MD001": true -} \ No newline at end of file +} From d1449a9503f2d293c1b3f8c7acad2403195d507f Mon Sep 17 00:00:00 2001 From: Miguel Guerreiro Date: Fri, 26 Sep 2025 13:48:53 +0100 Subject: [PATCH 3/5] configure job name --- .github/workflows/sync-automated-style-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sync-automated-style-validation.yml b/.github/workflows/sync-automated-style-validation.yml index f63619a..3dbbd69 100644 --- a/.github/workflows/sync-automated-style-validation.yml +++ b/.github/workflows/sync-automated-style-validation.yml @@ -11,6 +11,7 @@ on: jobs: sync: + name: Synchronise style guide files with dependent repositories runs-on: ubuntu-latest strategy: matrix: From cf7360e7e5e6bb20a5e627ce7d1a09fd4be8938e Mon Sep 17 00:00:00 2001 From: Miguel Guerreiro Date: Mon, 29 Sep 2025 10:17:26 +0100 Subject: [PATCH 4/5] fix: Update readme --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a231b9f..353cdbb 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,29 @@ on: pull_request: jobs: + get-changed-md: + name: Get changed .md files + runs-on: ubuntu-latest + outputs: + changed-md: ${{ steps.changed.outputs.all_changed_files }} + steps: + - uses: actions/checkout@v4 + - name: Get changed markdown files + id: changed + uses: tj-actions/changed-files@v45 + with: + files: | + **/*.md + - name: Debug changed files + run: echo "Changed MD files ${{ steps.changed.outputs.all_changed_files }}" + call-markdownlint: + name: Run Markdownlint validation + needs: get-changed-md + if: ${{ needs.get-changed-md.outputs.changed-md != '' }} uses: OutSystems/tk-cicd/.github/workflows/style-guides-validation.yml@main - + with: + paths-to-lint: ${{ needs.get-changed-md.outputs.changed-md }} secrets: github-token: ${{ secrets.GITHUB_TOKEN }} ``` From 115f3d856ba1f5aec14031db84a0179d28634efc Mon Sep 17 00:00:00 2001 From: Miguel Guerreiro Date: Mon, 29 Sep 2025 11:44:34 +0100 Subject: [PATCH 5/5] Update .markdownlint.json file --- automated-style-validation/.markdownlint.json | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/automated-style-validation/.markdownlint.json b/automated-style-validation/.markdownlint.json index 25b7122..6cb5dd3 100644 --- a/automated-style-validation/.markdownlint.json +++ b/automated-style-validation/.markdownlint.json @@ -1,4 +1,49 @@ { - "default": false, - "MD001": true + "default": true, + "heading-style": { + "style": "atx" + }, + "ul-style": { + "style": "asterisk" + }, + "ul-indent": { + "indent": 4 + }, + "no-trailing-spaces": { + "br_spaces": 2 + }, + "line-length": false, + "commands-show-output": false, + "no-missing-space-closed-atx": false, + "no-duplicate-heading": { + "siblings_only": true + }, + "single-h1": { + "front_matter_title": "" + }, + "no-trailing-punctuation": false, + "ol-prefix": { + "style": "one" + }, + "fenced-code-language": false, + "first-line-h1": { + "front_matter_title": "" + }, + "required-headings": false, + "proper-names": false, + "code-block-style": false, + "code-fence-style": { + "style": "backtick" + }, + "emphasis-style": { + "style": "underscore" + }, + "table-pipe-style": { + "style": "leading_and_trailing" + }, + "no-inline-html": { + "allowed_elements": [ + "div" + ] + } }