Skip to content

Commit dd13ffb

Browse files
authored
update github action to use newer versions of dependent actions (#625)
1 parent 0218352 commit dd13ffb

File tree

5 files changed

+47
-29
lines changed

5 files changed

+47
-29
lines changed

.github/actions/checkout/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ runs:
2121
- name: Get changed files in the .github folder
2222
if: github.event_name == 'pull_request_target'
2323
id: changedWorkflowFiles
24-
uses: tj-actions/changed-files@v35
24+
uses: tj-actions/changed-files@v42
2525
with:
2626
files: |
2727
.github/**

.github/workflows/activation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
uses: game-ci/unity-request-activation-file@v2
1313
# Upload artifact (Unity_v20XX.X.XXXX.alf)
1414
- name: Expose as artifact
15-
uses: actions/upload-artifact@v2
15+
uses: actions/upload-artifact@v4
1616
with:
1717
name: ${{ steps.getManualLicenseFile.outputs.filePath }}
1818
path: ${{ steps.getManualLicenseFile.outputs.filePath }}

.github/workflows/main.yml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ jobs:
2323

2424
steps:
2525
- name: Checkout action file
26-
uses: Bhacaz/checkout-files@v2
26+
uses: actions/checkout@v4
2727
with:
28-
files: .github/actions/checkout/action.yml
28+
sparse-checkout: .github/actions/checkout/action.yml
29+
sparse-checkout-cone-mode: false
2930

3031
- name: Checkout
3132
uses: ./.github/actions/checkout
@@ -56,9 +57,10 @@ jobs:
5657

5758
steps:
5859
- name: Checkout action file
59-
uses: Bhacaz/checkout-files@v2
60+
uses: actions/checkout@v4
6061
with:
61-
files: .github/actions/checkout/action.yml
62+
sparse-checkout: .github/actions/checkout/action.yml
63+
sparse-checkout-cone-mode: false
6264

6365
- name: Checkout
6466
uses: ./.github/actions/checkout
@@ -69,7 +71,7 @@ jobs:
6971
version: ${{ needs.determineVersionNumber.outputs.version }}
7072

7173
- name: Upload NuGetForUnity dlls
72-
uses: actions/upload-artifact@v3
74+
uses: actions/upload-artifact@v4
7375
with:
7476
name: NuGetForUnity-dlls
7577
path: |
@@ -81,15 +83,15 @@ jobs:
8183
- name: Check if files in NuGetForUnity.PluginAPI changed
8284
if: github.event_name == 'pull_request_target'
8385
id: changedPluginApiCode
84-
uses: tj-actions/changed-files@v41
86+
uses: tj-actions/changed-files@v42
8587
with:
8688
files: |
8789
src/NuGetForUnity.PluginAPI/**.cs
8890
8991
- name: Check if NuGetForUnity.PluginAPI.dll is updated
9092
if: github.event_name == 'pull_request_target'
9193
id: changedPluginApiDll
92-
uses: tj-actions/changed-files@v41
94+
uses: tj-actions/changed-files@v42
9395
with:
9496
files: |
9597
src/NuGetForUnity/Editor/PluginAPI/NuGetForUnity.PluginAPI.dll
@@ -112,15 +114,16 @@ jobs:
112114

113115
steps:
114116
- name: Checkout action file
115-
uses: Bhacaz/checkout-files@v2
117+
uses: actions/checkout@v4
116118
with:
117-
files: .github/actions/checkout/action.yml
119+
sparse-checkout: .github/actions/checkout/action.yml
120+
sparse-checkout-cone-mode: false
118121

119122
- name: Checkout
120123
uses: ./.github/actions/checkout
121124

122125
- name: Download NuGetForUnity dlls
123-
uses: actions/download-artifact@v3
126+
uses: actions/download-artifact@v4
124127
with:
125128
name: NuGetForUnity-dlls
126129
path: ./src/NuGetForUnity.Packager/Assets/NuGet/Editor
@@ -145,7 +148,7 @@ jobs:
145148
version: ${{ needs.determineVersionNumber.outputs.version }}
146149

147150
- name: Upload UnityPackage
148-
uses: actions/upload-artifact@v3
151+
uses: actions/upload-artifact@v4
149152
with:
150153
name: NuGetForUnity.${{ needs.determineVersionNumber.outputs.version }}.unitypackage
151154
path: ./src/NuGetForUnity.Packager/NugetForUnity.unitypackage
@@ -158,15 +161,16 @@ jobs:
158161

159162
steps:
160163
- name: Checkout action file
161-
uses: Bhacaz/checkout-files@v2
164+
uses: actions/checkout@v4
162165
with:
163-
files: .github/actions/checkout/action.yml
166+
sparse-checkout: .github/actions/checkout/action.yml
167+
sparse-checkout-cone-mode: false
164168

165169
- name: Checkout
166170
uses: ./.github/actions/checkout
167171

168172
- name: Setup dotnet
169-
uses: actions/setup-dotnet@v3
173+
uses: actions/setup-dotnet@v4
170174
with:
171175
dotnet-version: "8.0.x"
172176

@@ -195,7 +199,7 @@ jobs:
195199
--source https://api.nuget.org/v3/index.json
196200
197201
- name: Upload NuGet packages
198-
uses: actions/upload-artifact@v3
202+
uses: actions/upload-artifact@v4
199203
with:
200204
name: NuGetForUnity-NuGetPackages
201205
path: |
@@ -208,9 +212,10 @@ jobs:
208212
runs-on: ubuntu-latest
209213
steps:
210214
- name: Checkout action file
211-
uses: Bhacaz/checkout-files@v2
215+
uses: actions/checkout@v4
212216
with:
213-
files: .github/actions/checkout/action.yml
217+
sparse-checkout: .github/actions/checkout/action.yml
218+
sparse-checkout-cone-mode: false
214219

215220
- name: Checkout
216221
uses: ./.github/actions/checkout
@@ -239,15 +244,16 @@ jobs:
239244

240245
steps:
241246
- name: Checkout action file
242-
uses: Bhacaz/checkout-files@v2
247+
uses: actions/checkout@v4
243248
with:
244-
files: .github/actions/checkout/action.yml
249+
sparse-checkout: .github/actions/checkout/action.yml
250+
sparse-checkout-cone-mode: false
245251

246252
- name: Checkout
247253
uses: ./.github/actions/checkout
248254

249255
- name: Download NuGetForUnity.Cli NuGet package
250-
uses: actions/download-artifact@v3
256+
uses: actions/download-artifact@v4
251257
with:
252258
name: NuGetForUnity-NuGetPackages
253259
path: .

src/NuGetForUnity.Tests/Assets/Tests/Editor/NuGetTests.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ public void InstallRoslynAnalyzerTest([Values] InstallMode installMode)
9797
var meta = (PluginImporter)AssetImporter.GetAtPath(path);
9898

9999
#if UNITY_2022_3_OR_NEWER
100+
100101
// somehow unity doesn't import the .dll on newer unity version
101-
var postprocessor = new NugetAssetPostprocessor() { assetPath = path };
102+
var postprocessor = new NugetAssetPostprocessor { assetPath = path };
102103
postprocessor.GetType().GetMethod("OnPreprocessAsset", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(postprocessor, null);
103104
#endif
104105

@@ -162,14 +163,16 @@ public void InstallRoslynAnalyzerWithMultipleVersionsTest(string unityVersion, s
162163

163164
foreach (var roslynAnalyzerVersion in roslynAnalyzerVersions)
164165
{
165-
var path = $"Assets/Packages/{jsonPackageId.Id}.{jsonPackageId.Version}/analyzers/dotnet/roslyn{roslynAnalyzerVersion}/cs/System.Text.Json.SourceGeneration.dll";
166+
var path =
167+
$"Assets/Packages/{jsonPackageId.Id}.{jsonPackageId.Version}/analyzers/dotnet/roslyn{roslynAnalyzerVersion}/cs/System.Text.Json.SourceGeneration.dll";
166168
Assert.That(path, Does.Exist.IgnoreDirectories);
167169
var meta = (PluginImporter)AssetImporter.GetAtPath(path);
168170
meta.SaveAndReimport();
169171

170172
#if UNITY_2022_3_OR_NEWER
173+
171174
// somehow unity doesn't import the .dll on newer unity version
172-
var postprocessor = new NugetAssetPostprocessor() { assetPath = path };
175+
var postprocessor = new NugetAssetPostprocessor { assetPath = path };
173176
postprocessor.GetType().GetMethod("OnPreprocessAsset", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(postprocessor, null);
174177
#endif
175178
}
@@ -178,7 +181,8 @@ public void InstallRoslynAnalyzerWithMultipleVersionsTest(string unityVersion, s
178181

179182
foreach (var roslynAnalyzerVersion in roslynAnalyzerVersions)
180183
{
181-
var path = $"Assets/Packages/{jsonPackageId.Id}.{jsonPackageId.Version}/analyzers/dotnet/roslyn{roslynAnalyzerVersion}/cs/System.Text.Json.SourceGeneration.dll";
184+
var path =
185+
$"Assets/Packages/{jsonPackageId.Id}.{jsonPackageId.Version}/analyzers/dotnet/roslyn{roslynAnalyzerVersion}/cs/System.Text.Json.SourceGeneration.dll";
182186
Assert.That(path, Does.Exist.IgnoreDirectories);
183187
var meta = (PluginImporter)AssetImporter.GetAtPath(path);
184188
Assert.IsNotNull(meta, "Get meta file");
@@ -187,11 +191,17 @@ public void InstallRoslynAnalyzerWithMultipleVersionsTest(string unityVersion, s
187191
Assert.IsFalse(meta.GetCompatibleWithEditor(), "Expected to have set compatible with editor to false");
188192
if (roslynAnalyzerVersion == expectedEnabledRoslynAnalyzerVersion)
189193
{
190-
Assert.That(AssetDatabase.GetLabels(meta), Does.Contain("RoslynAnalyzer"), $"DLL of Roslyn analyzer version '{roslynAnalyzerVersion}' should have 'RoslynAnalyzer' label");
194+
Assert.That(
195+
AssetDatabase.GetLabels(meta),
196+
Does.Contain("RoslynAnalyzer"),
197+
$"DLL of Roslyn analyzer version '{roslynAnalyzerVersion}' should have 'RoslynAnalyzer' label");
191198
}
192199
else
193200
{
194-
Assert.That(AssetDatabase.GetLabels(meta), Does.Not.Contain("RoslynAnalyzer"), $"DLL of Roslyn analyzer version '{roslynAnalyzerVersion}' should not have 'RoslynAnalyzer' label");
201+
Assert.That(
202+
AssetDatabase.GetLabels(meta),
203+
Does.Not.Contain("RoslynAnalyzer"),
204+
$"DLL of Roslyn analyzer version '{roslynAnalyzerVersion}' should not have 'RoslynAnalyzer' label");
195205
}
196206
}
197207
}

src/NuGetForUnity/Editor/NugetAssetPostprocessor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@ private static void ModifyImportSettingsOfRoslynAnalyzer([NotNull] PluginImporte
255255
else
256256
{
257257
var versionPrefixIndex = assetPath.IndexOf(AnalyzersRoslynVersionsFolderName, StringComparison.Ordinal);
258-
var analyzerVersionsRootDirectoryPath = Path.Combine(assetPath.Substring(0, versionPrefixIndex), AnalyzersRoslynVersionsFolderName);
258+
var analyzerVersionsRootDirectoryPath = Path.Combine(
259+
assetPath.Substring(0, versionPrefixIndex),
260+
AnalyzersRoslynVersionsFolderName);
259261
var analyzersFolders = Directory.EnumerateDirectories(analyzerVersionsRootDirectoryPath);
260262
var allEnabledRoslynVersions = analyzersFolders.Select(GetRoslynVersionNumberFromAnalyzerPath)
261263
.Where(version => version != null && version.CompareTo(maxSupportedRoslynVersion) <= 0)

0 commit comments

Comments
 (0)