Skip to content

Added 5001 #3369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/snippets5001-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# This is a basic workflow to help you get started with Actions
name: Snippets 5001

# Controls when the action will run. Triggers the workflow on push or pull request
# events on the main branch only.
on:
pull_request:
branches: [release*]
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
reason:
description: "The reason for running the workflow"
required: true
default: "Manual run"

env:
DOTNET_VERSION: '9.0.x' # set this to the dot net version to use
EnableNuGetPackageRestore: "True"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: read

jobs:
# This workflow contains a single job called "snippets-build"
snippets-build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
statuses: write

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Print trigger context
run: |
echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
echo "Branch: ${GITHUB_REF#refs/heads/}"
echo "SHA: ${{ github.sha }}"
echo "Actor: ${{ github.actor }}"
echo "Repository: ${{ github.repository }}"
echo "Workflow: ${{ github.workflow }}"
echo "Run ID: ${{ github.run_id }}"
echo "Run Number: ${{ github.run_number }}"

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

# Get the latest preview SDK (or sdk not installed by the runner)
- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # main
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

# Print dotnet info
- name: Display .NET info
run: |
dotnet --info

# Rename conditional.nuget.config for release builds only
- name: Use release NuGet config
if: startsWith(github.head_ref, 'release') || startsWith(github.base_ref, 'release')
run: |
echo "Renaming conditional.nuget.config to nuget.config for release build"
mv conditional.nuget.config nuget.config

# Clone docs tools repo
- name: Clone docs-tools repository
run: |
git clone https://github.com/dotnet/docs-tools

# Run snippets 5000
- name: Run snippets 5000 for PR
env:
GitHubKey: ${{ secrets.GITHUB_TOKEN }}
run: |
dotnet run --project docs-tools/snippets5000/Snippets5000/Snippets5000.csproj -- --sourcepath "${{ github.workspace }}" --pullrequest ${{ github.event.number }} --owner ${{ github.repository_owner }} --repo ${{ github.event.repository.name }}

# Update build output json file
- name: Upload build results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #@v4.6.2
with:
name: build
path: ./output.json
Loading