diff --git a/.github/workflows/live-protection.yml b/.github/workflows/live-protection.yml index 3f097ac42e5..1aa5631ba4f 100644 --- a/.github/workflows/live-protection.yml +++ b/.github/workflows/live-protection.yml @@ -1,27 +1,25 @@ +name: Base branch checker on: [pull_request] permissions: contents: read jobs: - comment: + live_protection_job: + name: Check base branch runs-on: ubuntu-latest + steps: - name: Harden Runner - uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 with: egress-policy: audit - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea env: - SHOULD_COMMENT: ${{ github.base_ref == 'refs/heads/live' && !(github.head_ref == 'refs/heads/main') }} + LIVE_BASE: ${{ github.base_ref == 'live' && github.head_ref != 'main' }} with: script: | - if (process.env.SHOULD_COMMENT == 'true') { - github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'It looks like this pull request may have been opened on the `live` branch by mistake. In general, PRs should target the `main` branch.' - }) + if (process.env.LIVE_BASE == 'true') { + core.setFailed('PR targets live branch') } diff --git a/snippets/csharp/System.Windows/Rect/Overview/MyApp.xaml b/snippets/csharp/System.Windows/Rect/Overview/MyApp.xaml index 663f7c2e8da..69535dc8f44 100644 --- a/snippets/csharp/System.Windows/Rect/Overview/MyApp.xaml +++ b/snippets/csharp/System.Windows/Rect/Overview/MyApp.xaml @@ -1,4 +1,3 @@ - - - diff --git a/snippets/csharp/System.Windows/Rect/Overview/MyApp1.xaml.cs b/snippets/csharp/System.Windows/Rect/Overview/MyApp1.xaml.cs index c6d62bc2a97..e131785f30e 100644 --- a/snippets/csharp/System.Windows/Rect/Overview/MyApp1.xaml.cs +++ b/snippets/csharp/System.Windows/Rect/Overview/MyApp1.xaml.cs @@ -1,11 +1,6 @@ -using System; +using SDKSample; +using System; using System.Windows; -using System.Data; -using System.Xml; -using System.Configuration; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Navigation; namespace Microsoft.Samples.RectExamples { @@ -33,4 +28,4 @@ private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionE MessageBox.Show("Unhandled exception: " + args.ExceptionObject.ToString()); } } -} \ No newline at end of file +} diff --git a/snippets/csharp/System.Windows/Rect/Overview/RectExample.cs b/snippets/csharp/System.Windows/Rect/Overview/RectExample.cs index 764e52836b7..35e2d71ca9e 100644 --- a/snippets/csharp/System.Windows/Rect/Overview/RectExample.cs +++ b/snippets/csharp/System.Windows/Rect/Overview/RectExample.cs @@ -1,5 +1,4 @@ // -using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -23,7 +22,7 @@ public RectExample() // 150 wide. The left side of the rectangle is 10 pixels from the left of the // Canvas and the top side of the rectangle is 100 pixels from the top of the Canvas. // Note: You could alternatively use the Rect Constructor to create this: - // Rect my Rect1 = new Rect(10,100,150,100"); + // Rect myRect1 = new Rect(10, 100, 150, 100); Rect myRect1 = new Rect(); myRect1.X = 10; myRect1.Y = 100; diff --git a/snippets/csharp/System.Windows/Rect/Overview/RectExample1.cs b/snippets/csharp/System.Windows/Rect/Overview/RectExample1.cs index bbfb549b51a..4022e606d2d 100644 --- a/snippets/csharp/System.Windows/Rect/Overview/RectExample1.cs +++ b/snippets/csharp/System.Windows/Rect/Overview/RectExample1.cs @@ -1,12 +1,8 @@ using System; using System.Windows; using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Navigation; using System.Windows.Shapes; -using System.Windows.Data; using System.Windows.Media; -using System.Windows.Media.Animation; namespace Microsoft.Samples.RectExamples { diff --git a/snippets/csharp/System.Windows/Rect/Overview/Snippets.csproj b/snippets/csharp/System.Windows/Rect/Overview/Snippets.csproj index 7b3b00d71d5..d27d73b5981 100644 --- a/snippets/csharp/System.Windows/Rect/Overview/Snippets.csproj +++ b/snippets/csharp/System.Windows/Rect/Overview/Snippets.csproj @@ -1,8 +1,8 @@ - Exe - net6.0-windows + WinExe + net6.0-windows true