| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4e2e722 commit 98d6415
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -101,3 +101,4 @@ | |||
| 101 | 101 | /docs/area-owners.* @jeffhandley | |
| 102 | 102 | /docs/issue*.md @jeffhandley | |
| 103 | 103 | /.github/fabricbot.json @jeffhandley | |
| 104 | + /.github/workflows/ @jeffhandley @dotnet/runtime-infrastructure | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,22 @@ | |||
| 1 | + # Workflows | ||
| 2 | + | ||
| 3 | + General guidance: | ||
| 4 | + | ||
| 5 | + Please make sure to include the @dotnet/runtime-infrastructure group as a reviewer of your PRs. | ||
| 6 | + | ||
| 7 | + For workflows that are triggered by pull requests, refer to GitHub's documentation for the `pull_request` and `pull_request_target` events. The `pull_request_target` event is the more common use case in this repository as it runs the workflow in the context of the target branch instead of in the context of the pull request's fork or branch. However, workflows that need to consume the contents of the pull request need to use the `pull_request` event. There are security considerations with each of the events though. | ||
| 8 | + | ||
| 9 | + Most workflows are intended to run only in the `dotnet/runtime` repository and not in forks. To force workflow jobs to be skipped in forks, each job should apply an `if` statement that checks the repository name or owner. Either approach works, but checking only the repository owner allows the workflow to run in copies or forks withing the dotnet org. | ||
| 10 | + | ||
| 11 | + ```yaml | ||
| 12 | + jobs: | ||
| 13 | + job-1: | ||
| 14 | + # Do not run this job in forks | ||
| 15 | + if: github.repository == 'dotnet/runtime' | ||
| 16 | + | ||
| 17 | + job-2: | ||
| 18 | + # Do not run this job in forks outside the dotnet org | ||
| 19 | + if: github.repository_owner == 'dotnet' | ||
| 20 | + ``` | ||
| 21 | + | ||
| 22 | + Refer to GitHub's [Workflows in forked repositories](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflows-in-forked-repositories) and [pull_request_target](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target) documentation for more information. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,14 +4,15 @@ permissions: | |||
| 4 | 4 | pull-requests: read | |
| 5 | 5 | ||
| 6 | 6 | on: | |
| 7 | - pull_request: | ||
| 8 | - types: [opened, edited, reopened, labeled, unlabeled, synchronize] | ||
| 7 | + pull_request_target: | ||
| 8 | + types: [opened, reopened, labeled, unlabeled] | ||
| 9 | 9 | branches: | |
| 10 | 10 | - 'main' | |
| 11 | 11 | - 'release/**' | |
| 12 | 12 | ||
| 13 | 13 | jobs: | |
| 14 | 14 | check-labels: | |
| 15 | + if: github.repository == 'dotnet/runtime' | ||
| 15 | 16 | runs-on: ubuntu-latest | |
| 16 | 17 | steps: | |
| 17 | 18 | - name: Check 'NO-MERGE' label | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,13 +4,14 @@ permissions: | |||
| 4 | 4 | pull-requests: read | |
| 5 | 5 | ||
| 6 | 6 | on: | |
| 7 | - pull_request: | ||
| 8 | - types: [opened, edited, reopened, labeled, unlabeled, synchronize] | ||
| 7 | + pull_request_target: | ||
| 8 | + types: [opened, reopened, labeled, unlabeled] | ||
| 9 | 9 | branches: | |
| 10 | 10 | - 'release/**' | |
| 11 | 11 | ||
| 12 | 12 | jobs: | |
| 13 | 13 | check-labels: | |
| 14 | + if: github.repository == 'dotnet/runtime' | ||
| 14 | 15 | runs-on: ubuntu-latest | |
| 15 | 16 | steps: | |
| 16 | 17 | - name: Check 'Servicing-approved' label | |
| Back | FazBrowse Home | New Git URL |
0 commit comments