Automatically add go-version input if installGo == true

This commit is contained in:
Michael B. Gale
2025-08-14 11:50:03 +01:00
parent 9bd3c14196
commit bd79bc6b67
33 changed files with 265 additions and 112 deletions

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
all-platform-bundle:
strategy:
@@ -51,7 +61,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- id: init
uses: ./../action/init

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
analyze-ref-input:
strategy:
@@ -55,7 +65,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
build-mode-manual:
strategy:
@@ -51,7 +61,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
id: init

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
export-file-baseline-information:
strategy:
@@ -55,7 +65,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
id: init

View File

@@ -25,13 +25,15 @@ on:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
jobs:
go-custom-queries:
strategy:

View File

@@ -25,13 +25,15 @@ on:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
jobs:
go-indirect-tracing-workaround-diagnostic:
strategy:

View File

@@ -25,13 +25,15 @@ on:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
jobs:
go-indirect-tracing-workaround-no-file-program:
strategy:

View File

@@ -25,13 +25,15 @@ on:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
jobs:
go-indirect-tracing-workaround:
strategy:

View File

@@ -25,13 +25,15 @@ on:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
jobs:
go-tracing-autobuilder:
strategy:

View File

@@ -25,13 +25,15 @@ on:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
jobs:
go-tracing-custom-build-steps:
strategy:

View File

@@ -25,13 +25,15 @@ on:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
jobs:
go-tracing-legacy-workflow:
strategy:

3
.github/workflows/__go.yml generated vendored
View File

@@ -16,7 +16,8 @@ on:
go-version:
type: string
description: The version of Go to install
required: true
required: false
default: '>=1.21.0'
jobs:
go-custom-queries:
name: 'Go: Custom queries'

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
multi-language-autodetect:
strategy:
@@ -81,7 +91,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
id: init

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
packaging-codescanning-config-inputs-js:
strategy:
@@ -67,7 +77,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
packaging-config-inputs-js:
strategy:
@@ -67,7 +77,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
packaging-config-js:
strategy:
@@ -67,7 +77,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
packaging-inputs-js:
strategy:
@@ -67,7 +77,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
remote-config:
strategy:
@@ -53,7 +63,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
split-workflow:
strategy:
@@ -61,7 +71,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
swift-custom-build:
strategy:
@@ -55,7 +65,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
id: init

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
test-local-codeql:
strategy:
@@ -51,7 +61,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Fetch a CodeQL bundle
shell: bash

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
unset-environment:
strategy:
@@ -53,7 +63,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
id: init

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
upload-quality-sarif:
strategy:
@@ -55,7 +65,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
upload-ref-sha-input:
strategy:
@@ -55,7 +65,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- uses: ./../action/init
with:

View File

@@ -21,9 +21,19 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
jobs:
with-checkout-path:
strategy:
@@ -55,7 +65,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Delete original checkout
shell: bash

View File

@@ -1,11 +1,6 @@
name: "Go: Custom queries"
description: "Checks that Go works in conjunction with a config file specifying custom queries"
collection: go
inputs:
go-version:
type: string
description: "The version of Go to install"
required: true
operatingSystems:
- ubuntu
versions:

View File

@@ -6,11 +6,6 @@ operatingSystems: ["ubuntu"]
versions: ["default"]
installGo: "true"
collection: go
inputs:
go-version:
type: string
description: "The version of Go to install"
required: true
steps:
- uses: ./../action/init
with:

View File

@@ -6,11 +6,6 @@ operatingSystems: ["ubuntu"]
versions: ["default"]
installGo: "true"
collection: go
inputs:
go-version:
type: string
description: "The version of Go to install"
required: true
steps:
- name: Remove `file` program
run: |

View File

@@ -6,11 +6,6 @@ operatingSystems: ["ubuntu"]
versions: ["default"]
installGo: "true"
collection: go
inputs:
go-version:
type: string
description: "The version of Go to install"
required: true
steps:
- uses: ./../action/init
with:

View File

@@ -1,11 +1,6 @@
name: "Go: tracing with autobuilder step"
description: "Checks that Go tracing works when using an autobuilder step"
collection: go
inputs:
go-version:
type: string
description: "The version of Go to install"
required: true
operatingSystems: ["ubuntu", "macos"]
env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"

View File

@@ -1,11 +1,6 @@
name: "Go: tracing with custom build steps"
description: "Checks that Go tracing traces the build when using custom build steps"
collection: go
inputs:
go-version:
type: string
description: "The version of Go to install"
required: true
operatingSystems: ["ubuntu", "macos"]
installGo: "true"
steps:

View File

@@ -1,11 +1,6 @@
name: "Go: tracing with legacy workflow"
description: "Checks that we run the autobuilder in legacy workflows with neither an autobuild step nor manual build steps"
collection: go
inputs:
go-version:
type: string
description: "The version of Go to install"
required: true
operatingSystems: ["ubuntu", "macos"]
env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"

View File

@@ -119,16 +119,19 @@ for file in (this_dir / 'checks').glob('*.yml'):
installGo = True if checkSpecification['installGo'].lower() == "true" else False
if installGo:
goVersionExpr = '>=1.21.0'
if 'inputs' in checkSpecification and 'go-version' in checkSpecification['inputs']:
goVersionExpr = '${{ inputs.go-version || \'>=1.21.0\' }}'
baseGoVersionExpr = '>=1.21.0'
workflowInputs['go-version'] = {
'type': 'string',
'description': 'The version of Go to install',
'required': False,
'default': baseGoVersionExpr,
}
steps.append({
'name': 'Install Go',
'uses': 'actions/setup-go@v5',
'with': {
'go-version': goVersionExpr,
'go-version': '${{ inputs.go-version || \'' + baseGoVersionExpr + '\' }}',
# to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache
'cache': False
@@ -176,7 +179,8 @@ for file in (this_dir / 'checks').glob('*.yml'):
collection_name = checkSpecification['collection']
collections.setdefault(collection_name, []).append({
'specification': checkSpecification,
'checkName': checkName
'checkName': checkName,
'inputs': workflowInputs
})
raw_file = this_dir.parent / ".github" / "workflows" / f"__{checkName}.yml.raw"
@@ -222,14 +226,13 @@ for collection_name in collections:
for check in collections[collection_name]:
checkName = check['checkName']
checkSpecification = check['specification']
checkInputs = {}
checkInputs = check['inputs']
checkWith = {}
if 'inputs' in checkSpecification:
combinedInputs |= checkSpecification['inputs']
combinedInputs |= checkInputs
for inputName in checkSpecification['inputs'].keys():
checkWith[inputName] = "${{ inputs." + inputName + " }}"
for inputName in checkInputs.keys():
checkWith[inputName] = "${{ inputs." + inputName + " }}"
jobs[checkName] = {
'name': checkSpecification['name'],