|
8 | 8 | push: |
9 | 9 | branches: ["main"] |
10 | 10 | tags-ignore: ["v*-*"] |
11 | | - pull_request: |
| 11 | + pull_request_target: |
| 12 | + types: [opened, synchronize, labeled] |
12 | 13 | branches: ["main"] |
13 | 14 | workflow_dispatch: |
14 | 15 | inputs: |
|
31 | 32 | # Setup & Configuration |
32 | 33 | Setup: |
33 | 34 | name: "Setup & Configuration " |
| 35 | + if: ${{ (github.event_name == 'push') || |
| 36 | + (github.event_name == 'workflow_dispatch') || |
| 37 | + (github.event_name == 'pull_request_target' && |
| 38 | + (github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'safe-to-build'))) |
| 39 | + }} |
34 | 40 | runs-on: ubuntu-latest |
35 | 41 | outputs: |
36 | 42 | GitVersion_BranchName: ${{ steps.gitversion.outputs.GitVersion_BranchName }} |
|
54 | 60 | nkdAgility_RunRelease: ${{ steps.nkdagility.outputs.RunRelease }} |
55 | 61 | nkdAgility_AzureSitesEnvironment: ${{ steps.nkdagility.outputs.AzureSitesEnvironment }} |
56 | 62 | steps: |
| 63 | + - uses: actions/create-github-app-token@v1 |
| 64 | + id: app-token |
| 65 | + with: |
| 66 | + app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }} |
| 67 | + private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }} |
| 68 | + - name: Remove "safe" label from PR |
| 69 | + if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} |
| 70 | + uses: actions-ecosystem/action-remove-labels@v1 |
| 71 | + with: |
| 72 | + token: ${{ steps.app-token.outputs.token }} |
| 73 | + labels: safe-to-build |
57 | 74 | - name: Checkout |
58 | 75 | uses: actions/checkout@v4 |
59 | 76 | with: |
| 77 | + repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }} |
| 78 | + ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }} |
60 | 79 | fetch-depth: 0 |
61 | 80 | - name: Install GitVersion |
62 | 81 | uses: gittools/actions/gitversion/[email protected] |
|
68 | 87 | uses: gittools/actions/gitversion/[email protected] |
69 | 88 | with: |
70 | 89 | useConfigFile: true |
71 | | - - uses: actions/create-github-app-token@v1 |
72 | | - id: app-token |
73 | | - with: |
74 | | - app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }} |
75 | | - private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }} |
| 90 | + |
76 | 91 | - uses: dorny/paths-filter@v3 |
77 | 92 | id: filter |
78 | 93 | with: |
|
84 | 99 | automation: |
85 | 100 | - 'build/**' |
86 | 101 | - '.github/workflows/**' |
| 102 | +
|
87 | 103 | - name: "Build NKDAgility Outputs" |
88 | 104 | shell: pwsh |
89 | 105 | id: nkdagility |
@@ -261,6 +277,9 @@ jobs: |
261 | 277 | distribution: 'zulu' |
262 | 278 | - name: Checkout |
263 | 279 | uses: actions/checkout@v4 |
| 280 | + with: |
| 281 | + repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }} |
| 282 | + ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }} |
264 | 283 | - uses: cschleiden/replace-tokens@v1 |
265 | 284 | with: |
266 | 285 | files: '["**/StaticVariables.cs"]' |
@@ -341,6 +360,9 @@ jobs: |
341 | 360 | GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }} |
342 | 361 | steps: |
343 | 362 | - uses: actions/checkout@v4 |
| 363 | + with: |
| 364 | + repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }} |
| 365 | + ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }} |
344 | 366 | - name: Setup Ruby |
345 | 367 | uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 |
346 | 368 | with: |
|
0 commit comments