Skip to content

Commit a61fcff

Browse files
committed
fix: address workflow code smell with boolean inputs.
Resolves one github gotcha with boolean input parameters. Now workflow parameters are enforced to be strings so we don't have to deal with several ways of evaluating whether something is true or false. Chore: enforced consistent formatting standards for github annotations and expressions. Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
1 parent 37f1f05 commit a61fcff

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

.github/workflows/auto-merge.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77
description: |
88
Enable automatic approval and merge of PRs initiated by a bot.
99
10-
type: boolean
10+
type: string
1111
required: false
12-
default: true
12+
default: 'true'
1313
organization-bot:
1414
description: |
1515
The bot name for your organization,
@@ -68,7 +68,7 @@ jobs:
6868
contents: write
6969
pull-requests: write
7070
runs-on: ubuntu-latest
71-
if: ${{ (inputs.enable-organization-bot == 'true' || inputs.enable-organization-bot == true) && github.event.pull_request.user.login == inputs.organization-bot }}
71+
if: ${{ inputs.enable-organization-bot == 'true' && github.event.pull_request.user.login == inputs.organization-bot }}
7272
env:
7373
PR_URL: ${{ github.event.pull_request.html_url }}
7474
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/bump-release.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ on:
1919
inputs:
2020
bump-patch:
2121
description: Bump a patch version release
22-
type: boolean
22+
type: string
2323
required: false
24-
default: true
24+
default: 'true'
2525
bump-minor:
2626
description: Bump a minor version release
27-
type: boolean
27+
type: string
2828
required: false
29-
default: false
29+
default: 'false'
3030
bump-major:
3131
description: Bump a major version release
32-
type: boolean
32+
type: string
3333
required: false
34-
default: false
34+
default: 'false'
3535
tag-message-title:
3636
description: Tag message title to prepend to the release notes
3737
required: false
@@ -48,8 +48,8 @@ on:
4848
4949
When enabled, you must pass the GPG secrets to this workflow.
5050
required: false
51-
type: boolean
52-
default: true
51+
type: string
52+
default: 'true'
5353
cliff-config:
5454
type: string
5555
required: false
@@ -125,10 +125,10 @@ jobs:
125125
fi
126126
127127
echo "next-tag=${NEXT_TAG}" >> "$GITHUB_OUTPUT"
128-
echo "::notice title=next-tag:${NEXT_TAG}"
128+
echo "::notice title=next-tag::${NEXT_TAG}"
129129
-
130130
name: Configure bot credentials
131-
if: ${{ inputs.enable-tag-signing == 'true' || inputs.enable-tag-signing == true }}
131+
if: ${{ inputs.enable-tag-signing == 'true' }}
132132
uses: go-openapi/gh-actions/ci-jobs/bot-credentials@6c7952706aa7afa9141262485767d9270ef5b00b # v1.3.0
133133
# This is using the GPG signature of bot-go-openapi.
134134
#
@@ -158,7 +158,7 @@ jobs:
158158
BODY=$(echo "${MESSAGE_BODY}"|tr '|' '\n')
159159
MESSAGE=$(printf "%s\n%s\n" "${MESSAGE}" "${BODY}")
160160
fi
161-
echo "::notice title=tag-message:${MESSAGE}"
161+
echo "::notice title=tag-message::${MESSAGE}"
162162
163163
SIGNED=""
164164
if [[ '${{ inputs.enable-tag-signing }}' == 'true' ]] ; then

.github/workflows/contributors.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ on:
1212
1313
When enabled, commits in the pull request will be signed with the bot's GPG key.
1414
required: false
15-
type: boolean
16-
default: true
15+
type: string
16+
default: 'true'
1717
secrets:
1818
github-app-id:
1919
description: |

.github/workflows/fuzz-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
echo "matrix<<EOF" >> "${GITHUB_OUTPUT}"
4646
printenv fuzz_tests >> "${GITHUB_OUTPUT}"
4747
echo "EOF" >> "${GITHUB_OUTPUT}"
48-
echo "::notice title=Fuzz tests found:${fuzz_tests}"
48+
echo "::notice title=Fuzz tests found::${fuzz_tests}"
4949
5050
fuzz-test:
5151
name: fuzz test
@@ -155,4 +155,4 @@ jobs:
155155
name: Report fuzz corpus cache size
156156
run: |
157157
FINAL_SIZE=$(du -m "${CORPUS_DIR}"|cut -f1)
158-
echo "::notice title=fuzz corpus size:${FINAL_SIZE}MB"
158+
echo "::notice title=fuzz corpus size::${FINAL_SIZE}MB"

.github/workflows/go-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
-
100100
name: Tests completed
101101
run: |
102-
echo "::notice title=Success:All tests passed"
102+
echo "::notice title=Success::All tests passed"
103103
104104
collect-coverage:
105105
needs: [test-complete]

.github/workflows/local-bump-release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ on:
1515
inputs:
1616
bump-patch:
1717
description: Bump a patch version release
18-
type: boolean
18+
type: string
1919
required: false
20-
default: true
20+
default: 'true'
2121
bump-minor:
2222
description: Bump a minor version release
23-
type: boolean
23+
type: string
2424
required: false
25-
default: false
25+
default: 'false'
2626
bump-major:
2727
description: Bump a major version release
28-
type: boolean
28+
type: string
2929
required: false
30-
default: false
30+
default: 'false'
3131
tag-message-title:
3232
description: Tag message title to prepend to the release notes
3333
required: false

experimental/pr-comment.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,18 @@ jobs:
9999
echo "proceed=true" >> "${GITHUB_OUTPUT}"
100100
101101
- name: Download message artifact
102-
if: ${{ steps.check_pr.outputs.proceed == 'true'}}
102+
if: ${{ steps.check_pr.outputs.proceed == 'true' }}
103103
id: download
104104
uses: actions/download-artifact@v5
105105
with:
106106
run-id: "${{ inputs.run_id }}"
107107
repository: "${{ env.TARGET }}"
108108
name: "${{ inputs.artifact_name }}"
109109
path: artifacts/
110-
github-token: ${{secrets.GITHUB_TOKEN}}
110+
github-token: ${{ secrets.GITHUB_TOKEN }}
111111

112112
- name: Check message artifact size
113-
if: ${{ steps.check_pr.outputs.proceed == 'true'}}
113+
if: ${{ steps.check_pr.outputs.proceed == 'true' }}
114114
run: |
115115
MESSAGE_FILE="${{ steps.download.outputs.download-path }}/${{ inputs.artifact_name }}"
116116
SIZE=$(cat "${MESSAGE_FILE}"|wc -c)
@@ -124,7 +124,7 @@ jobs:
124124
fi
125125
126126
- name: Find previous PR comment
127-
if: ${{ steps.check_pr.outputs.proceed == 'true'}}
127+
if: ${{ steps.check_pr.outputs.proceed == 'true' }}
128128
uses: peter-evans/find-comment@v3
129129
id: find_comment
130130
with:
@@ -135,7 +135,7 @@ jobs:
135135
token: ${{ secrets.GITHUB_TOKEN }}
136136

137137
- name: Create or update PR comment
138-
if: ${{ steps.check_pr.outputs.proceed == 'true'}}
138+
if: ${{ steps.check_pr.outputs.proceed == 'true' }}
139139
uses: peter-evans/create-or-update-comment@v4
140140
with:
141141
issue-number: ${{ inputs.pr_number }}

0 commit comments

Comments
 (0)