Skip to content

Update udl-list.json to new Open Rails file name. #937

Update udl-list.json to new Open Rails file name.

Update udl-list.json to new Open Rails file name. #937

Workflow file for this run

name: CI_build
on:
# was [push, pull_request, workflow_dispatch]
# separated because want to add schedule, which needs a
# normal conditions
push:
pull_request:
# on demand, from Actions tab
workflow_dispatch:
# on schedule (using cron syntax)
# 16:00 UTC (8:00am PST) on 6=Saturday
schedule:
- cron: "0 16 * * 6"
jobs:
validate:
runs-on: windows-latest
steps:
- name: 🚚 Checkout repo
uses: actions/checkout@v6
- name: πŸ“‘ Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: '3.13' # Uses the latest patch version of the given
- name: πŸ“‘ Install python modules
working-directory: .
run: python -m pip install -r requirements.txt
- name: πŸƒ Validate folders of XML types (UDLs, autoCompletion, functionList)
working-directory: .
run: python .validators\validator_xml.py
- name: πŸƒ Validate json and rebuild udl-list.md
working-directory: .
run: python .validators\validator_json.py --output-md
- name: πŸ”¨ Generate autoCompletion for all UDLs that don't already have one, and revalidate (primary repo + branch only)
working-directory: .
if: ${{ contains('push workflow_dispatch', github.event_name) && github.ref == 'refs/heads/master' && github.repository == 'notepad-plus-plus/userDefinedLanguages' }}
run: |
python .validators\generate_ac.py
# since AC XML may have been added, re-validate XML
python .validators\validator_xml.py
# since AC may have been added to JSON, need to revalidate JSON and re-generate md
python .validators\validator_json.py --output-md
- name: β‡… Sort JSON
working-directory: .
if: ${{ contains('push workflow_dispatch', github.event_name) && github.ref == 'refs/heads/master' && github.repository == 'notepad-plus-plus/userDefinedLanguages' }}
run: |
# sort JSON back into string
$file = "udl-list.json"
$a = Get-Content $file | ConvertFrom-Json
$a.'UDLs' = $a.'UDLs' | sort -Property 'id-name'
$content = $a | ConvertTo-Json -Depth 5
#
# reformat JSON
$content = $content -replace ': ', ": "
$content = $content -replace ' ', " "
$content = $content -replace ' ', " "
$content = $content -replace ' ', " "
#
# save sorted JSON text
$content > $file
- name: πŸŽ‰ Update repo with automated changes for the UDL list and autoCompletions
uses: stefanzweifel/git-auto-commit-action@v7
if: contains('push workflow_dispatch', github.event_name)
with:
commit_message: Automatically re-build udl-list.md and add new autoCompletions
unitTest:
name: FunctionList Unit Tests
runs-on: windows-latest
needs: validate
steps:
- name: 🚚 Checkout repo
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: πŸ” Check for Changes in functionList Files
id: get_changes
working-directory: .
run: |
# start assuming no changed FL files
$any_changed = $false
#
# validate event IDs before passing them to git diff:
git rev-parse --quiet --verify "${{ github.event.before }}^{commit}" >$null 2>&1
$invalid1 = $LASTEXITCODE -ne 0
git rev-parse --quiet --verify "${{ github.event.after }}^{commit}" >$null 2>&1
$invalid2 = $LASTEXITCODE -ne 0
# grab the changes
if("${{ github.event_name }}" -eq "workflow_dispatch" -or
"${{ github.event.before }}" -eq "0000000000000000000000000000000000000000" -or
"${{ github.event.after }}" -eq "0000000000000000000000000000000000000000" -or
$invalid1 -or $invalid2 ) {
#Write-Output "non-push or invalid object: use HEAD~1..HEAD, which isn't as specific, but better than nothing"
$changed_files = @( git diff --name-only HEAD~1..HEAD )
} else {
#Write-Output "for-push: use before/after"
$changed_files = @( git diff --name-only ${{ github.event.before }} ${{ github.event.after }} )
}
#
# check if each file is in functionList/ directory
foreach ($this_file in $changed_files) {
#Write-Output "the following is different: $this_file"
if ($this_file.Contains("functionList/")) {
Write-Output "+ Saw FunctionList changes in: $this_file"
$any_changed = $true
}
}
#
# set the output
if ($any_changed) {
echo "is_fl_changed=True" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}
- name: 🦎 Install Notepad++
if: ${{ steps.get_changes.outputs.is_fl_changed }}
uses: crazy-max/ghaction-chocolatey@v4
with:
args: install -y notepadplusplus
- name: πŸƒ Run FunctionList Unit Tests
if: ${{ steps.get_changes.outputs.is_fl_changed }}
working-directory: .\Test
run: |
$PowerEditorSource = "C:\Program Files\Notepad++\"
$PowerEditorLocal = ".\PowerEditor"
Copy-Item "$PowerEditorSource" -Destination "$PowerEditorLocal\bin" -Recurse -Force
New-Item "$PowerEditorLocal\bin\doLocalConf.xml" > $nul
New-Item "$PowerEditorLocal\bin\userDefineLangs" -ItemType Directory -ea 0 > $nul
python doUnitTests.py $PowerEditorLocal\bin