Skip to content

Commit b3c3a62

Browse files
Avoid redundant work in dependabot jobs (#3864)
Avoid redundant work when dependabot update jobs run.
1 parent 55b5f31 commit b3c3a62

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,7 @@
6464
<Include>[Swashbuckle.*]*</Include>
6565
<Threshold></Threshold>
6666
</PropertyGroup>
67+
<PropertyGroup>
68+
<IsDependabotJob Condition=" '$(GITHUB_ACTIONS)' == 'true' AND '$(DEPENDABOT_JOB_ID)' != '' ">true</IsDependabotJob>
69+
</PropertyGroup>
6770
</Project>

src/Swashbuckle.AspNetCore.ReDoc/Swashbuckle.AspNetCore.ReDoc.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<Compile Include="..\Shared\EmbeddedResourceProvider.cs" Link="EmbeddedResourceProvider.cs" />
4646
</ItemGroup>
4747

48-
<Target Name="NpmInstall" BeforeTargets="DispatchToInnerBuilds" Condition=" '$(CI)' != '' OR !Exists('$(MSBuildThisFileDirectory)\node_modules') ">
48+
<Target Name="NpmInstall" BeforeTargets="DispatchToInnerBuilds" Condition=" ('$(CI)' != '' OR !Exists('$(MSBuildThisFileDirectory)\node_modules')) AND '$(IsDependabotJob)' != 'true' ">
4949
<Exec Command="npm ci" ContinueOnError="true">
5050
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
5151
</Exec>

src/Swashbuckle.AspNetCore.SwaggerUI/Swashbuckle.AspNetCore.SwaggerUI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<Compile Include="..\Shared\EmbeddedResourceProvider.cs" Link="EmbeddedResourceProvider.cs" />
3939
</ItemGroup>
4040

41-
<Target Name="NpmInstall" BeforeTargets="DispatchToInnerBuilds" Condition=" '$(CI)' != '' OR !Exists('$(MSBuildThisFileDirectory)\node_modules') ">
41+
<Target Name="NpmInstall" BeforeTargets="DispatchToInnerBuilds" Condition=" ('$(CI)' != '' OR !Exists('$(MSBuildThisFileDirectory)\node_modules')) AND '$(IsDependabotJob)' != 'true' ">
4242
<Exec Command="npm ci" ContinueOnError="true">
4343
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
4444
</Exec>

test/WebSites/CliExample/CliExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
HOWEVER ... This example invokes the CLI DLL directly so that its source code can be tested during the Swashbuckle build process
2828
-->
2929

30-
<Target Name="SwaggerToFile" AfterTargets="AfterBuild">
30+
<Target Name="SwaggerToFile" AfterTargets="AfterBuild" Condition=" '$(IsDependabotJob)' != 'true' ">
3131
<Exec Command="dotnet dotnet-swagger.dll tofile --host http://localhost:51071 --output %22$(MSBuildThisFileDirectory)wwwroot/swagger/v1/swagger_$(TargetFramework).json%22 %22$(OutputPath)$(AssemblyName).dll%22 v1"
3232
WorkingDirectory="$(DotNetSwaggerPath)" />
3333
</Target>

test/WebSites/CliExampleWithFactory/CliExampleWithFactory.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
HOWEVER ... This example invokes the CLI DLL directly so that its source code can be tested during the Swashbuckle build process
3131
-->
3232

33-
<Target Name="SwaggerToFile" AfterTargets="AfterBuild">
33+
<Target Name="SwaggerToFile" AfterTargets="AfterBuild" Condition=" '$(IsDependabotJob)' != 'true' ">
3434
<Exec Command="dotnet dotnet-swagger.dll tofile --host http://localhost:57556/ --output %22$(MSBuildThisFileDirectory)wwwroot/swagger/v1/swagger_$(TargetFramework).json%22 %22$(OutputPath)$(AssemblyName).dll%22 v1"
3535
WorkingDirectory="$(DotNetSwaggerPath)" />
3636
</Target>

test/WebSites/NswagClientExample/NswagClientExample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
<Folder Include="NSwagClient\" />
2424
</ItemGroup>
2525

26-
<Target Name="SwaggerToFile" AfterTargets="AfterBuild">
26+
<Target Name="SwaggerToFile" AfterTargets="AfterBuild" Condition=" '$(IsDependabotJob)' != 'true' ">
2727
<Exec Command="dotnet dotnet-swagger.dll tofile --host http://example.com --output %22$(MSBuildThisFileDirectory)swagger_$(TargetFramework).json%22 %22$(OutputPath)$(AssemblyName).dll%22 v1"
2828
WorkingDirectory="$(DotNetSwaggerPath)" />
2929
</Target>
3030

31-
<Target Name="NSwag" AfterTargets="SwaggerToFile">
31+
<Target Name="NSwag" AfterTargets="SwaggerToFile" Condition=" '$(IsDependabotJob)' != 'true' ">
3232
<Exec Command="$(_NSwagTool) openapi2csclient /input:swagger_$(TargetFramework).json /namespace:NSwagClient /output:NSwagClient/Client.cs" />
3333
</Target>
3434

0 commit comments

Comments
 (0)