From d09a7012490c2422dd1083707db538f541fe0d29 Mon Sep 17 00:00:00 2001 From: "Andy (Steve) De George" <67293991+adegeo@users.noreply.github.com> Date: Fri, 16 Jul 2021 05:44:59 -0700 Subject: [PATCH] Update workflows (#1112) * Update build-validation.yml * Create live-protection.yml * Create docs-verifier.yml * Delete docs-verifier.yml --- .github/workflows/build-validation.yml | 17 ++++++++++------- .github/workflows/live-protection.yml | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/live-protection.yml diff --git a/.github/workflows/build-validation.yml b/.github/workflows/build-validation.yml index f71fb3d..33300e6 100644 --- a/.github/workflows/build-validation.yml +++ b/.github/workflows/build-validation.yml @@ -18,13 +18,14 @@ on: - "**.vbproj" - "**.fsproj" - "**.vcxproj" + - "**.sln" - "**global.json" - "**snippets.5000.json" branches: '*' env: - DOTNET_INSTALLER_CHANNEL: 'release/5.0.1xx' - DOTNET_DO_INSTALL: 'false' + DOTNET_INSTALLER_CHANNEL: '6.0' + DOTNET_DO_INSTALL: 'true' EnableNuGetPackageRestore: 'True' # A workflow run is made up of one or more jobs that can run sequentially or in parallel @@ -40,14 +41,19 @@ jobs: - uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 #@v2 # Get the latest preview SDK (or sdk not installed by the runner) - - name: Setup .NET Core SDK Preview + - name: Setup .NET SDK if: ${{ env.DOTNET_DO_INSTALL == 'true' }} run: | echo "Downloading dotnet-install.ps1" Invoke-WebRequest https://raw.githubusercontent.com/dotnet/install-scripts/master/src/dotnet-install.ps1 -OutFile dotnet-install.ps1 echo "Installing dotnet version ${{ env.DOTNET_INSTALLER_CHANNEL }}" .\dotnet-install.ps1 -InstallDir "c:\program files\dotnet" -Channel "${{ env.DOTNET_INSTALLER_CHANNEL }}" - + + # Print dotnet info + - name: Display .NET info + run: | + dotnet --info + # Install locate projs global tool - name: Install LocateProjects tool run: | @@ -72,6 +78,3 @@ jobs: - name: Report status run: | ./.github/workflows/dependencies/Out-GithubActionStatus.ps1 - - - diff --git a/.github/workflows/live-protection.yml b/.github/workflows/live-protection.yml new file mode 100644 index 0000000..4ce00ba --- /dev/null +++ b/.github/workflows/live-protection.yml @@ -0,0 +1,19 @@ +on: [pull_request_target] + +jobs: + comment: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v4 + env: + SHOULD_COMMENT: ${{ github.base_ref == 'refs/heads/live' && !(github.event.issue.user.login == 'cxwtool' || github.head_ref == 'refs/heads/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.' + }) + }