com.wallstop-studios.dxmessaging 2.0.0-rc27.1 → 2.0.0-rc27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.csharpierignore +1 -0
- package/.csharpierrc.json +3 -0
- package/.editorconfig +1 -1
- package/.gitattributes +25 -3
- package/.github/dependabot.yml +24 -2
- package/.github/workflows/csharpier-autofix.yml +24 -15
- package/.github/workflows/format-on-demand.yml +305 -0
- package/.github/workflows/json-format-check.yml +15 -6
- package/.github/workflows/lint-doc-links.yml +30 -0
- package/.github/workflows/markdown-json.yml +45 -0
- package/.github/workflows/markdownlint.yml +17 -6
- package/.github/workflows/npm-publish.yml +3 -3
- package/.github/workflows/prettier-autofix.yml +195 -0
- package/.github/workflows/update-dotnet-tools.yml +80 -0
- package/.github/workflows/yaml-format-lint.yml +41 -0
- package/.lychee.toml +24 -18
- package/.markdownlint-cli2.jsonc +8 -2
- package/.markdownlint.json +21 -0
- package/.markdownlint.jsonc +15 -24
- package/.markdownlintignore +7 -0
- package/.pre-commit-config.yaml +34 -38
- package/.prettierignore +21 -0
- package/.prettierrc.json +13 -2
- package/.yamllint.yaml +31 -0
- package/AGENTS.md +2 -0
- package/CONTRIBUTING.md +6 -0
- package/Docs/Advanced.md +8 -0
- package/Docs/Comparisons.md +17 -17
- package/Docs/Compatibility.md +4 -4
- package/Docs/DesignAndArchitecture.md +122 -6
- package/Docs/EmitShorthands.md +19 -16
- package/Docs/FAQ.md +8 -1
- package/Docs/GettingStarted.md +118 -15
- package/Docs/Glossary.md +13 -13
- package/Docs/Helpers.md +9 -9
- package/Docs/Index.md +8 -7
- package/Docs/InterceptorsAndOrdering.md +40 -0
- package/Docs/MessageTypes.md +1 -1
- package/Docs/MigrationGuide.md +1 -0
- package/Docs/Patterns.md +11 -11
- package/Docs/Performance.md +11 -11
- package/Docs/QuickStart.md +3 -3
- package/Docs/Reference.md +10 -10
- package/Docs/TargetingAndContext.md +14 -14
- package/Docs/Troubleshooting.md +1 -1
- package/Docs/VisualGuide.md +8 -8
- package/README.md +11 -11
- package/Runtime/Core/MessageBus/IMessageBus.cs +2 -0
- package/Runtime/Core/MessageBus/MessageBus.cs +401 -123
- package/Runtime/Core/MessageHandler.cs +995 -212
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +16 -16
- package/Tests/Runtime/Core/MutationDedupeTests.cs +98 -0
- package/Tests/Runtime/Core/MutationDedupeTests.cs.meta +11 -0
- package/Tests/Runtime/Core/MutationDestructionTests.cs +434 -0
- package/Tests/Runtime/Core/MutationDestructionTests.cs.meta +11 -0
- package/Tests/Runtime/Core/MutationDuringEmissionTests.cs +2021 -0
- package/Tests/Runtime/Core/MutationDuringEmissionTests.cs.meta +11 -0
- package/Tests/Runtime/Core/MutationGlobalAddTests.cs +99 -0
- package/Tests/Runtime/Core/MutationGlobalAddTests.cs.meta +11 -0
- package/Tests/Runtime/Core/MutationInterceptorTests.cs +187 -0
- package/Tests/Runtime/Core/MutationInterceptorTests.cs.meta +11 -0
- package/Tests/Runtime/Core/MutationPostProcessorAcrossHandlersTests.cs +112 -0
- package/Tests/Runtime/Core/MutationPostProcessorAcrossHandlersTests.cs.meta +11 -0
- package/Tests/Runtime/Core/MutationPostProcessorMoreTests.cs +114 -0
- package/Tests/Runtime/Core/MutationPostProcessorMoreTests.cs.meta +11 -0
- package/Tests/Runtime/Core/MutationPriorityTests.cs +116 -0
- package/Tests/Runtime/Core/MutationPriorityTests.cs.meta +11 -0
- package/Tests/Runtime/Core/OrderingTests.cs +1 -1
- package/Tests/Runtime/WallstopStudios.DxMessaging.Tests.Runtime.csproj +5 -5
- package/package-lock.json.meta +7 -0
- package/package.json +14 -2
- package/scripts/check-eol.js +94 -0
- package/scripts/check-eol.js.meta +7 -0
- package/scripts/check-eol.ps1 +91 -0
- package/scripts/check-eol.ps1.meta +8 -0
- package/scripts/fix-eol.js +97 -0
- package/scripts/fix-eol.js.meta +7 -0
- package/scripts/fix-markdown-file.js +64 -0
- package/scripts/fix-markdown-file.js.meta +7 -0
- package/scripts/lint-doc-links.ps1 +25 -0
- package/scripts/lint-doc-links.ps1.meta +7 -0
- package/scripts.meta +8 -0
package/.csharpierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Runtime/Binaries/*.xml
|
package/.editorconfig
CHANGED
package/.gitattributes
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
###############################################################################
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# Line endings
|
|
3
|
+
#
|
|
4
|
+
# Enforce CRLF in the working tree for all text files to align with
|
|
5
|
+
# .editorconfig (end_of_line = crlf, charset = utf-8 without BOM) and avoid
|
|
6
|
+
# formatter diffs on Linux runners.
|
|
5
7
|
###############################################################################
|
|
6
8
|
* text=auto eol=crlf
|
|
7
9
|
|
|
10
|
+
# Be explicit for common text file types in this repo
|
|
11
|
+
*.cs text eol=crlf
|
|
12
|
+
*.csproj text eol=crlf
|
|
13
|
+
*.sln text eol=crlf
|
|
14
|
+
*.json text eol=crlf
|
|
15
|
+
*.yaml text eol=crlf
|
|
16
|
+
*.yml text eol=crlf
|
|
17
|
+
*.md text eol=crlf
|
|
18
|
+
*.xml text eol=crlf
|
|
19
|
+
*.uxml text eol=crlf
|
|
20
|
+
*.uss text eol=crlf
|
|
21
|
+
*.shader text eol=crlf
|
|
22
|
+
*.hlsl text eol=crlf
|
|
23
|
+
*.compute text eol=crlf
|
|
24
|
+
*.cginc text eol=crlf
|
|
25
|
+
*.asmdef text eol=crlf
|
|
26
|
+
*.asmref text eol=crlf
|
|
27
|
+
*.meta text eol=crlf
|
|
28
|
+
*.ps1 text eol=crlf
|
|
29
|
+
|
|
8
30
|
###############################################################################
|
|
9
31
|
# Set default behavior for command prompt diff.
|
|
10
32
|
#
|
package/.github/dependabot.yml
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
version: 2
|
|
2
2
|
updates:
|
|
3
|
+
# GitHub Actions workflow updates
|
|
3
4
|
- package-ecosystem: "github-actions"
|
|
4
5
|
directory: "/"
|
|
5
6
|
schedule:
|
|
6
|
-
interval: "
|
|
7
|
+
interval: "daily"
|
|
7
8
|
assignees:
|
|
8
9
|
- wallstop
|
|
9
10
|
reviewers:
|
|
10
|
-
- wallstop
|
|
11
|
+
- wallstop
|
|
12
|
+
|
|
13
|
+
# NuGet: .csproj/props/targets and .config/dotnet-tools.json (local tools)
|
|
14
|
+
- package-ecosystem: "nuget"
|
|
15
|
+
directory: "/"
|
|
16
|
+
schedule:
|
|
17
|
+
interval: "daily"
|
|
18
|
+
assignees:
|
|
19
|
+
- wallstop
|
|
20
|
+
reviewers:
|
|
21
|
+
- wallstop
|
|
22
|
+
|
|
23
|
+
# npm/UPM: package.json at repo root (Unity package manifest)
|
|
24
|
+
- package-ecosystem: "npm"
|
|
25
|
+
directory: "/"
|
|
26
|
+
schedule:
|
|
27
|
+
interval: "daily"
|
|
28
|
+
versioning-strategy: increase
|
|
29
|
+
assignees:
|
|
30
|
+
- wallstop
|
|
31
|
+
reviewers:
|
|
32
|
+
- wallstop
|
|
@@ -16,39 +16,41 @@ jobs:
|
|
|
16
16
|
runs-on: ubuntu-latest
|
|
17
17
|
steps:
|
|
18
18
|
- name: Checkout
|
|
19
|
-
uses: actions/checkout@
|
|
19
|
+
uses: actions/checkout@v5
|
|
20
20
|
with:
|
|
21
21
|
fetch-depth: 0
|
|
22
22
|
|
|
23
23
|
- name: Setup .NET
|
|
24
|
-
uses: actions/setup-dotnet@
|
|
24
|
+
uses: actions/setup-dotnet@v5
|
|
25
25
|
with:
|
|
26
|
-
dotnet-version:
|
|
26
|
+
dotnet-version: "8.0.x"
|
|
27
27
|
|
|
28
28
|
- name: Restore .NET tools
|
|
29
29
|
run: dotnet tool restore
|
|
30
30
|
|
|
31
31
|
- name: Run CSharpier (format repository)
|
|
32
|
-
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
|
|
32
|
+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login == 'dependabot[bot]' }}
|
|
33
33
|
run: dotnet tool run csharpier format
|
|
34
34
|
|
|
35
|
-
- name: Commit formatting changes to PR branch (
|
|
36
|
-
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
|
|
37
|
-
uses: stefanzweifel/git-auto-commit-action@
|
|
35
|
+
- name: Commit formatting changes to PR branch (Dependabot only)
|
|
36
|
+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login == 'dependabot[bot]' }}
|
|
37
|
+
uses: stefanzweifel/git-auto-commit-action@v7
|
|
38
38
|
with:
|
|
39
|
-
commit_message:
|
|
39
|
+
commit_message: "chore(format): apply CSharpier formatting"
|
|
40
40
|
branch: ${{ github.head_ref }}
|
|
41
|
+
file_pattern: |
|
|
42
|
+
**/*.cs
|
|
41
43
|
|
|
42
44
|
- name: Verify formatting (CI gate)
|
|
43
45
|
run: dotnet tool run csharpier check .
|
|
44
46
|
|
|
45
47
|
format_fork:
|
|
46
|
-
name: Fork PR bot formatting PR
|
|
47
|
-
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository }}
|
|
48
|
+
name: Fork PR bot formatting PR (Dependabot only)
|
|
49
|
+
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && github.event.pull_request.user.login == 'dependabot[bot]' }}
|
|
48
50
|
runs-on: ubuntu-latest
|
|
49
51
|
steps:
|
|
50
52
|
- name: Checkout fork PR HEAD
|
|
51
|
-
uses: actions/checkout@
|
|
53
|
+
uses: actions/checkout@v5
|
|
52
54
|
with:
|
|
53
55
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
54
56
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
@@ -56,9 +58,9 @@ jobs:
|
|
|
56
58
|
fetch-depth: 0
|
|
57
59
|
|
|
58
60
|
- name: Setup .NET
|
|
59
|
-
uses: actions/setup-dotnet@
|
|
61
|
+
uses: actions/setup-dotnet@v5
|
|
60
62
|
with:
|
|
61
|
-
dotnet-version:
|
|
63
|
+
dotnet-version: "8.0.x"
|
|
62
64
|
|
|
63
65
|
- name: Install CSharpier (pinned)
|
|
64
66
|
run: dotnet tool install -g csharpier --version 1.1.2
|
|
@@ -88,7 +90,8 @@ jobs:
|
|
|
88
90
|
git config user.name "github-actions[bot]"
|
|
89
91
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
90
92
|
git checkout -B "$BRANCH"
|
|
91
|
-
|
|
93
|
+
# Only stage C# files to avoid touching workflow YAML (requires special permissions)
|
|
94
|
+
git add '**/*.cs'
|
|
92
95
|
git commit -m "chore(format): apply CSharpier formatting for PR #${{ github.event.pull_request.number }}"
|
|
93
96
|
git remote add upstream "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
|
|
94
97
|
git fetch upstream
|
|
@@ -136,7 +139,13 @@ jobs:
|
|
|
136
139
|
const body = `A formatting PR has been opened: #${fmtPr.number} (applies CSharpier to this PR).`;
|
|
137
140
|
// Avoid duplicate comments by checking recent comments
|
|
138
141
|
const comments = await github.rest.issues.listComments({ owner, repo, issue_number: prNumber, per_page: 50 });
|
|
139
|
-
const already = comments.data.some(
|
|
142
|
+
const already = comments.data.some(
|
|
143
|
+
(c) =>
|
|
144
|
+
c.body &&
|
|
145
|
+
c.body.includes(`#${fmtPr.number}`) &&
|
|
146
|
+
c.user &&
|
|
147
|
+
c.user.login === 'github-actions[bot]'
|
|
148
|
+
);
|
|
140
149
|
if (!already) {
|
|
141
150
|
await github.rest.issues.createComment({ owner, repo, issue_number: prNumber, body });
|
|
142
151
|
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
name: Opt-in Formatting
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
pr_number:
|
|
9
|
+
description: PR number to format
|
|
10
|
+
required: true
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
pull-requests: write
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
by_comment:
|
|
18
|
+
name: Run on /format comment
|
|
19
|
+
if: >-
|
|
20
|
+
${{ github.event_name == 'issue_comment' &&
|
|
21
|
+
github.event.action == 'created' &&
|
|
22
|
+
github.event.issue.pull_request &&
|
|
23
|
+
(contains(github.event.comment.body, '/format') || contains(github.event.comment.body, '/autofix') || contains(github.event.comment.body, '/lint-fix')) }}
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- name: Resolve PR metadata and authorize request
|
|
27
|
+
id: meta
|
|
28
|
+
uses: actions/github-script@v7
|
|
29
|
+
with:
|
|
30
|
+
script: |
|
|
31
|
+
const prNumber = context.payload.issue.number;
|
|
32
|
+
const pr = (await github.rest.pulls.get({ ...context.repo, pull_number: prNumber })).data;
|
|
33
|
+
const commenter = context.payload.comment.user.login;
|
|
34
|
+
const prAuthor = pr.user.login;
|
|
35
|
+
const assoc = context.payload.comment.author_association; // OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, etc.
|
|
36
|
+
|
|
37
|
+
const isMaintainer = ['OWNER','MEMBER','COLLABORATOR'].includes(assoc);
|
|
38
|
+
const isAuthor = commenter === prAuthor;
|
|
39
|
+
const allowed = isMaintainer || isAuthor;
|
|
40
|
+
|
|
41
|
+
core.setOutput('allowed', String(allowed));
|
|
42
|
+
core.setOutput('pr', String(prNumber));
|
|
43
|
+
core.setOutput('base_ref', pr.base.ref);
|
|
44
|
+
core.setOutput('head_repo', pr.head.repo.full_name);
|
|
45
|
+
core.setOutput('head_ref', pr.head.ref);
|
|
46
|
+
core.setOutput('same_repo', String(pr.head.repo.full_name === `${context.repo.owner}/${context.repo.repo}`));
|
|
47
|
+
|
|
48
|
+
- name: Exit if not authorized
|
|
49
|
+
if: ${{ steps.meta.outputs.allowed != 'true' }}
|
|
50
|
+
run: |
|
|
51
|
+
echo "Commenter is not authorized to trigger formatting." 1>&2
|
|
52
|
+
exit 1
|
|
53
|
+
|
|
54
|
+
- name: Checkout PR branch (same-repo)
|
|
55
|
+
if: ${{ steps.meta.outputs.same_repo == 'true' }}
|
|
56
|
+
uses: actions/checkout@v5
|
|
57
|
+
with:
|
|
58
|
+
ref: ${{ steps.meta.outputs.head_ref }}
|
|
59
|
+
fetch-depth: 0
|
|
60
|
+
|
|
61
|
+
- name: Checkout PR fork head
|
|
62
|
+
if: ${{ steps.meta.outputs.same_repo != 'true' }}
|
|
63
|
+
uses: actions/checkout@v5
|
|
64
|
+
with:
|
|
65
|
+
repository: ${{ steps.meta.outputs.head_repo }}
|
|
66
|
+
ref: ${{ steps.meta.outputs.head_ref }}
|
|
67
|
+
persist-credentials: false
|
|
68
|
+
fetch-depth: 0
|
|
69
|
+
|
|
70
|
+
- name: Setup Node.js
|
|
71
|
+
uses: actions/setup-node@v5
|
|
72
|
+
with:
|
|
73
|
+
node-version: '20'
|
|
74
|
+
|
|
75
|
+
- name: Setup .NET
|
|
76
|
+
uses: actions/setup-dotnet@v5
|
|
77
|
+
with:
|
|
78
|
+
dotnet-version: '8.0.x'
|
|
79
|
+
|
|
80
|
+
- name: Restore .NET tools
|
|
81
|
+
run: dotnet tool restore
|
|
82
|
+
|
|
83
|
+
- name: Apply Prettier fixes
|
|
84
|
+
run: |
|
|
85
|
+
npx --yes prettier@3.3.3 --write "**/*.{md,markdown}"
|
|
86
|
+
npx --yes prettier@3.3.3 --write "**/*.{json,asmdef,asmref}"
|
|
87
|
+
npx --yes prettier@3.3.3 --write "**/*.{yml,yaml}"
|
|
88
|
+
|
|
89
|
+
- name: Apply markdownlint fixes
|
|
90
|
+
run: |
|
|
91
|
+
npx --yes markdownlint-cli@0.40.0 "**/*.md" "**/*.markdown" --config .markdownlint.json --ignore-path .markdownlintignore --fix
|
|
92
|
+
|
|
93
|
+
- name: Apply CSharpier formatting
|
|
94
|
+
run: dotnet tool run csharpier format
|
|
95
|
+
|
|
96
|
+
- name: Detect changes
|
|
97
|
+
id: changes
|
|
98
|
+
shell: bash
|
|
99
|
+
run: |
|
|
100
|
+
if git diff --quiet; then
|
|
101
|
+
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
102
|
+
else
|
|
103
|
+
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
- name: Commit changes to PR branch (same-repo)
|
|
107
|
+
if: ${{ steps.meta.outputs.same_repo == 'true' && steps.changes.outputs.has_changes == 'true' }}
|
|
108
|
+
uses: stefanzweifel/git-auto-commit-action@v7
|
|
109
|
+
with:
|
|
110
|
+
commit_message: "chore(format): apply requested formatting"
|
|
111
|
+
branch: ${{ steps.meta.outputs.head_ref }}
|
|
112
|
+
file_pattern: |
|
|
113
|
+
**/*.cs
|
|
114
|
+
**/*.md
|
|
115
|
+
**/*.markdown
|
|
116
|
+
**/*.json
|
|
117
|
+
**/*.asmdef
|
|
118
|
+
**/*.asmref
|
|
119
|
+
|
|
120
|
+
- name: Create bot branch and PR (fork)
|
|
121
|
+
if: ${{ steps.meta.outputs.same_repo != 'true' && steps.changes.outputs.has_changes == 'true' }}
|
|
122
|
+
shell: bash
|
|
123
|
+
env:
|
|
124
|
+
GH_REPO: ${{ github.repository }}
|
|
125
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
126
|
+
run: |
|
|
127
|
+
set -euo pipefail
|
|
128
|
+
BRANCH="bot/format/pr-${{ steps.meta.outputs.pr }}"
|
|
129
|
+
git config user.name "github-actions[bot]"
|
|
130
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
131
|
+
git checkout -B "$BRANCH"
|
|
132
|
+
# Stage only supported text files; avoid workflows to prevent permission issues
|
|
133
|
+
git add '**/*.cs' '**/*.md' '**/*.markdown' '**/*.json' '**/*.asmdef' '**/*.asmref'
|
|
134
|
+
git commit -m "chore(format): apply requested formatting for PR #${{ steps.meta.outputs.pr }}"
|
|
135
|
+
git remote add upstream "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
|
|
136
|
+
git fetch upstream
|
|
137
|
+
git push upstream "$BRANCH" --force
|
|
138
|
+
|
|
139
|
+
- name: Open/Update formatting PR (fork)
|
|
140
|
+
if: ${{ steps.meta.outputs.same_repo != 'true' && steps.changes.outputs.has_changes == 'true' }}
|
|
141
|
+
uses: actions/github-script@v7
|
|
142
|
+
with:
|
|
143
|
+
script: |
|
|
144
|
+
const prNumber = Number(core.getInput('pr')) || Number('${{ steps.meta.outputs.pr }}');
|
|
145
|
+
const baseRef = '${{ steps.meta.outputs.base_ref }}';
|
|
146
|
+
const headBranch = `bot/format/pr-${prNumber}`;
|
|
147
|
+
const {owner, repo} = context.repo;
|
|
148
|
+
const title = `chore(format): Apply formatting to PR #${prNumber}`;
|
|
149
|
+
const body = [
|
|
150
|
+
`This automated PR applies Prettier/markdownlint/CSharpier formatting to the changes from PR #${prNumber}.`,
|
|
151
|
+
'',
|
|
152
|
+
`- Source PR (fork): #${prNumber}`,
|
|
153
|
+
`- Target branch: ${baseRef}`,
|
|
154
|
+
].join('\n');
|
|
155
|
+
const existing = await github.rest.pulls.list({ owner, repo, state: 'open', head: `${owner}:${headBranch}` });
|
|
156
|
+
if (existing.data.length === 0) {
|
|
157
|
+
await github.rest.pulls.create({ owner, repo, head: headBranch, base: baseRef, title, body });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
- name: Comment result on PR
|
|
161
|
+
if: ${{ steps.changes.outputs.has_changes == 'true' }}
|
|
162
|
+
uses: actions/github-script@v7
|
|
163
|
+
with:
|
|
164
|
+
script: |
|
|
165
|
+
const prNumber = Number('${{ steps.meta.outputs.pr }}');
|
|
166
|
+
const sameRepo = '${{ steps.meta.outputs.same_repo }}' === 'true';
|
|
167
|
+
const body = sameRepo
|
|
168
|
+
? 'Applied formatting as requested and pushed commits to this PR branch.'
|
|
169
|
+
: 'Opened a formatting PR against the base repository with requested fixes.';
|
|
170
|
+
await github.rest.issues.createComment({ ...context.repo, issue_number: prNumber, body });
|
|
171
|
+
|
|
172
|
+
- name: No-op comment (nothing to change)
|
|
173
|
+
if: ${{ steps.changes.outputs.has_changes != 'true' }}
|
|
174
|
+
uses: actions/github-script@v7
|
|
175
|
+
with:
|
|
176
|
+
script: |
|
|
177
|
+
const prNumber = Number('${{ steps.meta.outputs.pr }}');
|
|
178
|
+
const body = 'No formatting changes were necessary.';
|
|
179
|
+
await github.rest.issues.createComment({ ...context.repo, issue_number: prNumber, body });
|
|
180
|
+
|
|
181
|
+
by_dispatch:
|
|
182
|
+
name: Run via manual dispatch
|
|
183
|
+
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
184
|
+
runs-on: ubuntu-latest
|
|
185
|
+
steps:
|
|
186
|
+
- name: Resolve PR metadata
|
|
187
|
+
id: meta
|
|
188
|
+
uses: actions/github-script@v7
|
|
189
|
+
with:
|
|
190
|
+
script: |
|
|
191
|
+
const prNumber = Number(core.getInput('pr_number'));
|
|
192
|
+
if (!prNumber) core.setFailed('pr_number is required');
|
|
193
|
+
const pr = (await github.rest.pulls.get({ ...context.repo, pull_number: prNumber })).data;
|
|
194
|
+
core.setOutput('pr', String(prNumber));
|
|
195
|
+
core.setOutput('base_ref', pr.base.ref);
|
|
196
|
+
core.setOutput('head_repo', pr.head.repo.full_name);
|
|
197
|
+
core.setOutput('head_ref', pr.head.ref);
|
|
198
|
+
core.setOutput('same_repo', String(pr.head.repo.full_name === `${context.repo.owner}/${context.repo.repo}`));
|
|
199
|
+
|
|
200
|
+
- name: Checkout PR branch (same-repo)
|
|
201
|
+
if: ${{ steps.meta.outputs.same_repo == 'true' }}
|
|
202
|
+
uses: actions/checkout@v5
|
|
203
|
+
with:
|
|
204
|
+
ref: ${{ steps.meta.outputs.head_ref }}
|
|
205
|
+
fetch-depth: 0
|
|
206
|
+
|
|
207
|
+
- name: Checkout PR fork head
|
|
208
|
+
if: ${{ steps.meta.outputs.same_repo != 'true' }}
|
|
209
|
+
uses: actions/checkout@v5
|
|
210
|
+
with:
|
|
211
|
+
repository: ${{ steps.meta.outputs.head_repo }}
|
|
212
|
+
ref: ${{ steps.meta.outputs.head_ref }}
|
|
213
|
+
persist-credentials: false
|
|
214
|
+
fetch-depth: 0
|
|
215
|
+
|
|
216
|
+
- name: Setup Node.js
|
|
217
|
+
uses: actions/setup-node@v5
|
|
218
|
+
with:
|
|
219
|
+
node-version: '20'
|
|
220
|
+
|
|
221
|
+
- name: Setup .NET
|
|
222
|
+
uses: actions/setup-dotnet@v5
|
|
223
|
+
with:
|
|
224
|
+
dotnet-version: '8.0.x'
|
|
225
|
+
|
|
226
|
+
- name: Restore .NET tools
|
|
227
|
+
run: dotnet tool restore
|
|
228
|
+
|
|
229
|
+
- name: Apply Prettier fixes
|
|
230
|
+
run: |
|
|
231
|
+
npx --yes prettier@3.3.3 --write "**/*.{md,markdown}"
|
|
232
|
+
npx --yes prettier@3.3.3 --write "**/*.{json,asmdef,asmref}"
|
|
233
|
+
npx --yes prettier@3.3.3 --write "**/*.{yml,yaml}"
|
|
234
|
+
|
|
235
|
+
- name: Apply markdownlint fixes
|
|
236
|
+
run: |
|
|
237
|
+
npx --yes markdownlint-cli@0.40.0 "**/*.md" "**/*.markdown" --config .markdownlint.json --ignore-path .markdownlintignore --fix
|
|
238
|
+
|
|
239
|
+
- name: Apply CSharpier formatting
|
|
240
|
+
run: dotnet tool run csharpier format
|
|
241
|
+
|
|
242
|
+
- name: Detect changes
|
|
243
|
+
id: changes
|
|
244
|
+
shell: bash
|
|
245
|
+
run: |
|
|
246
|
+
if git diff --quiet; then
|
|
247
|
+
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
248
|
+
else
|
|
249
|
+
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
250
|
+
fi
|
|
251
|
+
|
|
252
|
+
- name: Commit changes to PR branch (same-repo)
|
|
253
|
+
if: ${{ steps.meta.outputs.same_repo == 'true' && steps.changes.outputs.has_changes == 'true' }}
|
|
254
|
+
uses: stefanzweifel/git-auto-commit-action@v7
|
|
255
|
+
with:
|
|
256
|
+
commit_message: "chore(format): apply requested formatting"
|
|
257
|
+
branch: ${{ steps.meta.outputs.head_ref }}
|
|
258
|
+
file_pattern: |
|
|
259
|
+
**/*.cs
|
|
260
|
+
**/*.md
|
|
261
|
+
**/*.markdown
|
|
262
|
+
**/*.json
|
|
263
|
+
**/*.asmdef
|
|
264
|
+
**/*.asmref
|
|
265
|
+
|
|
266
|
+
- name: Create bot branch and PR (fork)
|
|
267
|
+
if: ${{ steps.meta.outputs.same_repo != 'true' && steps.changes.outputs.has_changes == 'true' }}
|
|
268
|
+
shell: bash
|
|
269
|
+
env:
|
|
270
|
+
GH_REPO: ${{ github.repository }}
|
|
271
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
272
|
+
run: |
|
|
273
|
+
set -euo pipefail
|
|
274
|
+
BRANCH="bot/format/pr-${{ steps.meta.outputs.pr }}"
|
|
275
|
+
git config user.name "github-actions[bot]"
|
|
276
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
277
|
+
git checkout -B "$BRANCH"
|
|
278
|
+
# Stage only supported text files; avoid workflows to prevent permission issues
|
|
279
|
+
git add '**/*.cs' '**/*.md' '**/*.markdown' '**/*.json' '**/*.asmdef' '**/*.asmref'
|
|
280
|
+
git commit -m "chore(format): apply requested formatting for PR #${{ steps.meta.outputs.pr }}"
|
|
281
|
+
git remote add upstream "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
|
|
282
|
+
git fetch upstream
|
|
283
|
+
git push upstream "$BRANCH" --force
|
|
284
|
+
|
|
285
|
+
- name: Open/Update formatting PR (fork)
|
|
286
|
+
if: ${{ steps.meta.outputs.same_repo != 'true' && steps.changes.outputs.has_changes == 'true' }}
|
|
287
|
+
uses: actions/github-script@v7
|
|
288
|
+
with:
|
|
289
|
+
script: |
|
|
290
|
+
const prNumber = Number('${{ steps.meta.outputs.pr }}');
|
|
291
|
+
const baseRef = '${{ steps.meta.outputs.base_ref }}';
|
|
292
|
+
const headBranch = `bot/format/pr-${prNumber}`;
|
|
293
|
+
const {owner, repo} = context.repo;
|
|
294
|
+
const title = `chore(format): Apply formatting to PR #${prNumber}`;
|
|
295
|
+
const body = [
|
|
296
|
+
`This automated PR applies Prettier/markdownlint/CSharpier formatting to the changes from PR #${prNumber}.`,
|
|
297
|
+
'',
|
|
298
|
+
`- Source PR (fork): #${prNumber}`,
|
|
299
|
+
`- Target branch: ${baseRef}`,
|
|
300
|
+
].join('\n');
|
|
301
|
+
const existing = await github.rest.pulls.list({ owner, repo, state: 'open', head: `${owner}:${headBranch}` });
|
|
302
|
+
if (existing.data.length === 0) {
|
|
303
|
+
await github.rest.pulls.create({ owner, repo, head: headBranch, base: baseRef, title, body });
|
|
304
|
+
}
|
|
305
|
+
|
|
@@ -4,7 +4,7 @@ on:
|
|
|
4
4
|
pull_request:
|
|
5
5
|
push:
|
|
6
6
|
branches:
|
|
7
|
-
-
|
|
7
|
+
- main
|
|
8
8
|
workflow_dispatch:
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
@@ -13,13 +13,22 @@ jobs:
|
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
steps:
|
|
15
15
|
- name: Checkout
|
|
16
|
-
uses: actions/checkout@
|
|
16
|
+
uses: actions/checkout@v5
|
|
17
17
|
|
|
18
18
|
- name: Setup Node
|
|
19
|
-
uses: actions/setup-node@
|
|
19
|
+
uses: actions/setup-node@v5
|
|
20
20
|
with:
|
|
21
|
-
node-version:
|
|
21
|
+
node-version: "20"
|
|
22
|
+
cache: 'npm'
|
|
23
|
+
cache-dependency-path: package.json
|
|
22
24
|
|
|
23
|
-
- name:
|
|
24
|
-
run:
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
if [ -f package-lock.json ]; then
|
|
28
|
+
npm ci
|
|
29
|
+
else
|
|
30
|
+
npm i --no-audit --no-fund
|
|
31
|
+
fi
|
|
25
32
|
|
|
33
|
+
- name: Prettier check (JSON / asmdef)
|
|
34
|
+
run: npm run format:json:check
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Lint Docs Links
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v5
|
|
15
|
+
|
|
16
|
+
- name: Run Markdown link linter
|
|
17
|
+
shell: pwsh
|
|
18
|
+
run: ./scripts/lint-doc-links.ps1 -VerboseOutput
|
|
19
|
+
|
|
20
|
+
- name: Check dead links (lychee)
|
|
21
|
+
uses: lycheeverse/lychee-action@v2
|
|
22
|
+
with:
|
|
23
|
+
args: >-
|
|
24
|
+
-c .lychee.toml
|
|
25
|
+
--no-progress
|
|
26
|
+
--include-fragments
|
|
27
|
+
--verbose
|
|
28
|
+
"./**/*.md"
|
|
29
|
+
env:
|
|
30
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Markdown & JSON Lint/Format
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
validate:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v5
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v5
|
|
21
|
+
with:
|
|
22
|
+
node-version: '20'
|
|
23
|
+
cache: 'npm'
|
|
24
|
+
cache-dependency-path: package.json
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: |
|
|
28
|
+
if [ -f package-lock.json ]; then
|
|
29
|
+
npm ci
|
|
30
|
+
else
|
|
31
|
+
npm i --no-audit --no-fund
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
- name: Prettier check (Markdown)
|
|
35
|
+
run: npm run format:md:check
|
|
36
|
+
|
|
37
|
+
- name: Prettier check (JSON / asmdef / asmref)
|
|
38
|
+
run: npm run format:json:check
|
|
39
|
+
|
|
40
|
+
- name: Markdown lint
|
|
41
|
+
run: npm run lint:markdown
|
|
42
|
+
|
|
43
|
+
- name: Enforce EOL (CRLF) and No BOM
|
|
44
|
+
shell: pwsh
|
|
45
|
+
run: ./scripts/check-eol.ps1 -VerboseOutput
|
|
@@ -10,11 +10,22 @@ jobs:
|
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
12
|
- name: Checkout
|
|
13
|
-
uses: actions/checkout@
|
|
13
|
+
uses: actions/checkout@v5
|
|
14
14
|
|
|
15
|
-
- name:
|
|
16
|
-
uses:
|
|
15
|
+
- name: Setup Node.js
|
|
16
|
+
uses: actions/setup-node@v5
|
|
17
17
|
with:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
node-version: '20'
|
|
19
|
+
cache: 'npm'
|
|
20
|
+
cache-dependency-path: package.json
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
if [ -f package-lock.json ]; then
|
|
25
|
+
npm ci
|
|
26
|
+
else
|
|
27
|
+
npm i --no-audit --no-fund
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
- name: Run markdownlint via npm script (CLI2 + repo config)
|
|
31
|
+
run: npm run lint:markdown
|
|
@@ -5,7 +5,7 @@ on:
|
|
|
5
5
|
branches:
|
|
6
6
|
- master
|
|
7
7
|
paths:
|
|
8
|
-
-
|
|
8
|
+
- "package.json"
|
|
9
9
|
workflow_dispatch:
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
@@ -16,13 +16,13 @@ jobs:
|
|
|
16
16
|
- name: Checkout Repository
|
|
17
17
|
uses: actions/checkout@v5
|
|
18
18
|
with:
|
|
19
|
-
fetch-depth: 0
|
|
19
|
+
fetch-depth: 0 # Ensure full commit history for version comparison
|
|
20
20
|
|
|
21
21
|
- name: Set up Node.js
|
|
22
22
|
uses: actions/setup-node@v5
|
|
23
23
|
with:
|
|
24
24
|
node-version: 18
|
|
25
|
-
registry-url:
|
|
25
|
+
registry-url: "https://registry.npmjs.org/"
|
|
26
26
|
|
|
27
27
|
- name: Check if version changed
|
|
28
28
|
id: version_check
|