Skip to content

Commit e1d13fa

Browse files
authored
Merge branch 'main' into main
2 parents 63b2f3e + 9728790 commit e1d13fa

File tree

2 files changed

+49
-27
lines changed

2 files changed

+49
-27
lines changed

.github/workflows/labeler.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
name: "Pull Request Labeler"
2-
on:
3-
- pull_request_target
1+
# name: "Pull Request Labeler"
2+
# on:
3+
# - pull_request_target
44

5-
jobs:
6-
labeler:
7-
permissions:
8-
contents: read
9-
pull-requests: write
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v4
14-
- uses: actions/create-github-app-token@v1
15-
id: app-token
16-
with:
17-
app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }}
18-
private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }}
19-
- uses: actions/labeler@v5
20-
with:
21-
sync-labels: true
22-
repo-token: ${{ steps.app-token.outputs.token }}
5+
# jobs:
6+
# labeler:
7+
# permissions:
8+
# contents: read
9+
# pull-requests: write
10+
# runs-on: ubuntu-latest
11+
# steps:
12+
# - name: Checkout
13+
# uses: actions/checkout@v4
14+
# - uses: actions/create-github-app-token@v1
15+
# id: app-token
16+
# with:
17+
# app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }}
18+
# private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }}
19+
# - uses: actions/labeler@v5
20+
# with:
21+
# sync-labels: true
22+
# repo-token: ${{ steps.app-token.outputs.token }}

.github/workflows/main.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ on:
88
push:
99
branches: ["main"]
1010
tags-ignore: ["v*-*"]
11-
pull_request:
11+
pull_request_target:
12+
types: [opened, synchronize, labeled]
1213
branches: ["main"]
1314
workflow_dispatch:
1415
inputs:
@@ -31,6 +32,11 @@ jobs:
3132
# Setup & Configuration
3233
Setup:
3334
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+
}}
3440
runs-on: ubuntu-latest
3541
outputs:
3642
GitVersion_BranchName: ${{ steps.gitversion.outputs.GitVersion_BranchName }}
@@ -54,9 +60,22 @@ jobs:
5460
nkdAgility_RunRelease: ${{ steps.nkdagility.outputs.RunRelease }}
5561
nkdAgility_AzureSitesEnvironment: ${{ steps.nkdagility.outputs.AzureSitesEnvironment }}
5662
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
5774
- name: Checkout
5875
uses: actions/checkout@v4
5976
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 }}
6079
fetch-depth: 0
6180
- name: Install GitVersion
6281
uses: gittools/actions/gitversion/[email protected]
@@ -68,11 +87,7 @@ jobs:
6887
uses: gittools/actions/gitversion/[email protected]
6988
with:
7089
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+
7691
- uses: dorny/paths-filter@v3
7792
id: filter
7893
with:
@@ -84,6 +99,7 @@ jobs:
8499
automation:
85100
- 'build/**'
86101
- '.github/workflows/**'
102+
87103
- name: "Build NKDAgility Outputs"
88104
shell: pwsh
89105
id: nkdagility
@@ -261,6 +277,9 @@ jobs:
261277
distribution: 'zulu'
262278
- name: Checkout
263279
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 }}
264283
- uses: cschleiden/replace-tokens@v1
265284
with:
266285
files: '["**/StaticVariables.cs"]'
@@ -341,6 +360,9 @@ jobs:
341360
GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }}
342361
steps:
343362
- 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 }}
344366
- name: Setup Ruby
345367
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
346368
with:

0 commit comments

Comments
 (0)