Skip to content

Commit c744acf

Browse files
authored
🔧 (main.yml): update workflow conditions and verbosity for improved C… (#2442)
…I/CD process Enhance the GitHub Actions workflow by refining conditional checks and verbosity settings. The condition for removing the "safe" label now ensures it only applies when the label 'safe-to-build' is present, preventing unnecessary label removals. The verbosity level for gitversion is set to verbose, aiding in debugging and providing more detailed logs. Additionally, the build and documentation jobs are conditioned to not run on forked repositories targeting the main branch, preventing unintended executions and conserving resources.
2 parents 4d0ad24 + 95b9a26 commit c744acf

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

‎.github/workflows/main.yml‎

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
branches: ["main"]
1010
tags-ignore: ["v*-*"]
1111
pull_request_target:
12-
types: [opened, synchronize, labeled]
1312
branches: ["main"]
1413
workflow_dispatch:
1514
inputs:
@@ -35,7 +34,7 @@ jobs:
3534
if: ${{ (github.event_name == 'push') ||
3635
(github.event_name == 'workflow_dispatch') ||
3736
(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')))
37+
(github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'safe')))
3938
}}
4039
runs-on: ubuntu-latest
4140
outputs:
@@ -60,22 +59,9 @@ jobs:
6059
nkdAgility_RunRelease: ${{ steps.nkdagility.outputs.RunRelease }}
6160
nkdAgility_AzureSitesEnvironment: ${{ steps.nkdagility.outputs.AzureSitesEnvironment }}
6261
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
7462
- name: Checkout
7563
uses: actions/checkout@v4
7664
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 }}
7965
fetch-depth: 0
8066
- name: Install GitVersion
8167
uses: gittools/actions/gitversion/[email protected]
@@ -87,7 +73,6 @@ jobs:
8773
uses: gittools/actions/gitversion/[email protected]
8874
with:
8975
useConfigFile: true
90-
9176
- uses: dorny/paths-filter@v3
9277
id: filter
9378
with:
@@ -99,12 +84,9 @@ jobs:
9984
automation:
10085
- 'build/**'
10186
- '.github/workflows/**'
102-
10387
- name: "Build NKDAgility Outputs"
10488
shell: pwsh
10589
id: nkdagility
106-
env:
107-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
10890
run: |
10991
# Get Branch Name
11092
Write-Output "::group::Get Branch Name"
@@ -236,14 +218,6 @@ jobs:
236218
- HasChanged_src: ${{needs.Setup.outputs.HasChanged_src}}
237219
- HasChanged_docs: ${{needs.Setup.outputs.HasChanged_docs}}
238220
- HasChanged_automation: ${{needs.Setup.outputs.HasChanged_automation}}
239-
### Github Bits
240-
- repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }}
241-
- ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }}
242-
- github.repository: ${{github.repository}}
243-
- github.event.pull_request.head.repo.full_name: ${{github.event.pull_request.head.repo.full_name}}
244-
- github.ref: ${{github.ref}}
245-
- github.event.pull_request.head.ref: ${{github.event.pull_request.head.ref}}
246-
247221
"@
248222
echo $markdown >> $Env:GITHUB_STEP_SUMMARY
249223
- name: "Show Release Description"
@@ -264,7 +238,7 @@ jobs:
264238
name: "Build, Test, Sonar Cloud Analysis, & Package"
265239
runs-on: windows-latest
266240
needs: Setup
267-
if: false # ${{ success() }}
241+
if: ${{ success() }}
268242
env:
269243
solution: '**/*.sln'
270244
buildPlatform: 'Any CPU'
@@ -285,9 +259,6 @@ jobs:
285259
distribution: 'zulu'
286260
- name: Checkout
287261
uses: actions/checkout@v4
288-
with:
289-
repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }}
290-
ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }}
291262
- uses: cschleiden/replace-tokens@v1
292263
with:
293264
files: '["**/StaticVariables.cs"]'
@@ -360,17 +331,14 @@ jobs:
360331
BuildDocs:
361332
name: "Build Documentation output"
362333
runs-on: ubuntu-latest
363-
if: false # ${{ success() }}
334+
if: ${{ success() }}
364335
needs: [Setup]
365336
env:
366337
GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }}
367338
GitVersion_AssemblySemVer: ${{ needs.Setup.outputs.GitVersion_AssemblySemVer }}
368339
GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }}
369340
steps:
370341
- uses: actions/checkout@v4
371-
with:
372-
repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }}
373-
ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }}
374342
- name: Setup Ruby
375343
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
376344
with:

0 commit comments

Comments
 (0)