Skip to content

Commit b5937db

Browse files
authored
Add additional secret variables to dotnet quality (#15)
* Add additional-vars as secrets for dotnet quality * Add FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 * Fix typo * Better handle var in scripts * Always archive test results
1 parent 79ef8b6 commit b5937db

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

.github/workflows/reusable-container-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ jobs:
8989
vuln-type: 'os,library'
9090
severity: 'CRITICAL,HIGH'
9191
env:
92-
IMAGE_REF: ${{ inputs.image-path }}/${{ inputs.image-name }}:${{ inputs.image-tag }}
9392
GITHUB_TOKEN: ${{ github.token }}
93+
IMAGE_REF: ${{ inputs.image-path }}/${{ inputs.image-name }}:${{ inputs.image-tag }}

.github/workflows/reusable-dotnet-quality.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ on:
8585
sonar-token:
8686
description: Sonar token for login
8787
required: false
88+
additional-vars:
89+
description: "Additional variables"
90+
required: false
8891

8992
jobs:
9093
dotnet-quality:
@@ -96,9 +99,24 @@ jobs:
9699
steps:
97100
- name: Set additional variables
98101
shell: bash
102+
env:
103+
EXTRA_VARS: ${{ inputs.extra-vars }}
99104
run: |
100-
if [[ -n "${{ inputs.extra-vars }}" ]]; then
101-
echo "${{ inputs.extra-vars }}" >> "$GITHUB_ENV"
105+
if [[ -n "$EXTRA_VARS" ]]; then
106+
echo "$EXTRA_VARS" >> "$GITHUB_ENV"
107+
fi
108+
- name: Set additional secrets
109+
shell: bash
110+
env:
111+
ADDITIONAL_VARS: ${{ secrets.additional-vars }}
112+
run: |
113+
if [[ -n "$ADDITIONAL_VARS" ]]; then
114+
echo "$ADDITIONAL_VARS" | while IFS='=' read -r key val; do
115+
if [[ -n "$val" ]]; then
116+
echo "::add-mask::$val"
117+
fi
118+
done
119+
echo "$ADDITIONAL_VARS" >> "$GITHUB_ENV"
102120
fi
103121
- name: Disable git autocrlf
104122
if: ${{ inputs.operating-system == 'windows-latest' }}
@@ -152,6 +170,7 @@ jobs:
152170
- name: Create FOSSA report file
153171
if: ${{ inputs.fossa-enabled && steps.fossa.outputs.report != '' }}
154172
run: echo '${{ steps.fossa.outputs.report }}' > report/fossa.html
173+
continue-on-error: true
155174
- name: Generate SBOM with Syft
156175
uses: anchore/sbom-action@v0
157176
# with:
@@ -160,6 +179,7 @@ jobs:
160179
# output-file: sbom.json
161180
# upload-artifact: true # Auto-upload to workflow artifacts
162181
- name: Archive test results
182+
if: always()
163183
uses: actions/upload-artifact@v4
164184
with:
165185
name: dotnet-test-results
@@ -173,5 +193,4 @@ jobs:
173193
env:
174194
DOTNET_CLI_TELEMETRY_OPTOUT: 1
175195
DOTNET_NOLOGO: 1
176-
# https://docs.github.com/en/actions/reference/workflows-and-actions/contexts
177196
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)