Skip to content

Commit 2e7e2d5

Browse files
authored
Added 5001 (#3369)
1 parent a7c7136 commit 2e7e2d5

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# This is a basic workflow to help you get started with Actions
2+
name: Snippets 5001
3+
4+
# Controls when the action will run. Triggers the workflow on push or pull request
5+
# events on the main branch only.
6+
on:
7+
pull_request:
8+
branches: [release*]
9+
types: [opened, synchronize, reopened]
10+
workflow_dispatch:
11+
inputs:
12+
reason:
13+
description: "The reason for running the workflow"
14+
required: true
15+
default: "Manual run"
16+
17+
env:
18+
DOTNET_VERSION: '9.0.x' # set this to the dot net version to use
19+
EnableNuGetPackageRestore: "True"
20+
21+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
# This workflow contains a single job called "snippets-build"
27+
snippets-build:
28+
# The type of runner that the job will run on
29+
runs-on: ubuntu-latest
30+
permissions:
31+
statuses: write
32+
33+
# Steps represent a sequence of tasks that will be executed as part of the job
34+
steps:
35+
- name: Print trigger context
36+
run: |
37+
echo "Event: ${{ github.event_name }}"
38+
echo "Ref: ${{ github.ref }}"
39+
echo "Branch: ${GITHUB_REF#refs/heads/}"
40+
echo "SHA: ${{ github.sha }}"
41+
echo "Actor: ${{ github.actor }}"
42+
echo "Repository: ${{ github.repository }}"
43+
echo "Workflow: ${{ github.workflow }}"
44+
echo "Run ID: ${{ github.run_id }}"
45+
echo "Run Number: ${{ github.run_number }}"
46+
47+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
48+
- name: Harden Runner
49+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
50+
with:
51+
egress-policy: audit
52+
53+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54+
55+
# Get the latest preview SDK (or sdk not installed by the runner)
56+
- name: Setup .NET
57+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # main
58+
with:
59+
dotnet-version: ${{ env.DOTNET_VERSION }}
60+
61+
# Print dotnet info
62+
- name: Display .NET info
63+
run: |
64+
dotnet --info
65+
66+
# Rename conditional.nuget.config for release builds only
67+
- name: Use release NuGet config
68+
if: startsWith(github.head_ref, 'release') || startsWith(github.base_ref, 'release')
69+
run: |
70+
echo "Renaming conditional.nuget.config to nuget.config for release build"
71+
mv conditional.nuget.config nuget.config
72+
73+
# Clone docs tools repo
74+
- name: Clone docs-tools repository
75+
run: |
76+
git clone https://github.com/dotnet/docs-tools
77+
78+
# Run snippets 5000
79+
- name: Run snippets 5000 for PR
80+
env:
81+
GitHubKey: ${{ secrets.GITHUB_TOKEN }}
82+
run: |
83+
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 }}
84+
85+
# Update build output json file
86+
- name: Upload build results
87+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #@v4.6.2
88+
with:
89+
name: build
90+
path: ./output.json

0 commit comments

Comments
 (0)