Skip to content

Commit 5f6aec3

Browse files
Update common github actions (#3099)
Signed-off-by: Knative Automation <[email protected]>
1 parent 63c305b commit 5f6aec3

File tree

7 files changed

+9
-57
lines changed

7 files changed

+9
-57
lines changed

.github/workflows/knative-boilerplate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ name: Boilerplate
1919

2020
on:
2121
pull_request:
22-
branches: [ 'master', 'release-*' ]
22+
branches: [ 'main', 'master', 'release-*' ]
2323

2424
jobs:
2525

.github/workflows/knative-donotsubmit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ name: Do Not Submit
1919

2020
on:
2121
pull_request:
22-
branches: [ 'master', 'release-*' ]
22+
branches: [ 'main', 'master', 'release-*' ]
2323

2424
jobs:
2525

.github/workflows/knative-go-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ name: Build
1919

2020
on:
2121
pull_request:
22-
branches: [ 'master', 'release-*' ]
22+
branches: [ 'main', 'master', 'release-*' ]
2323

2424
jobs:
2525

.github/workflows/knative-go-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ name: Test
2020
on:
2121

2222
push:
23-
branches: [ 'master' ]
23+
branches: [ 'main', 'master' ]
2424

2525
pull_request:
26-
branches: [ 'master', 'release-*' ]
26+
branches: [ 'main', 'master', 'release-*' ]
2727

2828
jobs:
2929

.github/workflows/knative-security.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ name: 'Security'
1919

2020
on:
2121
push:
22-
branches: [ 'master', 'release-*' ]
22+
branches: [ 'main', 'master', 'release-*' ]
2323

2424
pull_request:
25-
branches: [ 'master', 'release-*' ]
25+
branches: [ 'main', 'master', 'release-*' ]
2626

2727
jobs:
2828
analyze:

.github/workflows/knative-style.yaml

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ name: Code Style
1919

2020
on:
2121
pull_request:
22-
branches: [ 'master', 'release-*' ]
22+
branches: [ 'main', 'master', 'release-*' ]
2323

2424
jobs:
2525

@@ -209,54 +209,6 @@ jobs:
209209
210210
echo '::endgroup::'
211211
212-
- name: Redundant Format
213-
shell: bash
214-
if: ${{ always() }}
215-
env:
216-
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
217-
run: |
218-
set -e
219-
cd "${GITHUB_WORKSPACE}" || exit 1
220-
221-
echo '::group:: Flagging possibly unnecessary format calls for trailing argument with reviewdog 🐶 ...'
222-
# Don't fail because of misspell
223-
set +o pipefail
224-
# For all look for formatting calls and extract the ones that
225-
# have only a single formatting argument and that argument is in the last position.
226-
# But exclude the `fmt.Errorf` calls since there's no `fmt.Error` and `errors.New` is not
227-
# as versatile.
228-
# Also ignore `%T` — to print the type and `%q` to quote the final string.
229-
fn=$(find . -path './vendor' -prune -o -path './third_party' -prune -o -name '*.pb.go' -prune -o -type f -name '*.go' -print)
230-
grep -nE '[^.]+\.(Fatalf|Errorf|Warnf|Infof|Debugf|Logf|Sprintf|Fprintf|Printf)[^\%]+%[^Tqx]",[^,]+' $fn | grep -v "fmt.Errorf" |
231-
while read -r ent ; do
232-
file=$(echo $ent | cut -d':' -f 1);
233-
line=$(echo $ent | cut -d':' -f 2);
234-
ch=$(echo $ent | cut -d':' -f3-);
235-
err="Unknown printer tool, please file an issue in knative-sandbox/.github and assign to @vagababov: $ch"
236-
if echo $ch | grep --quiet -E "^t.(Errorf|Fatalf|Logf)" ; then
237-
err=$(echo $ch | sed -E 's/(^t\.)(Fatal|Error|Log)f([^\%]+)( %[^Tqx]",)([^,]+)/\1\2\3",\5/')
238-
# Not a test. Here we deal with various loggers and fmt helpers.
239-
elif echo $ch | grep --quiet "log" ; then
240-
# Capture (x)?log(er)?.
241-
err=$(echo $ch | sed -E 's/(.*log.*\.)(Print|Fatal|Error|Info|Warn)f([^\%]+)(%[^Tq]",)([^,]+)/\1\2\3",\5/')
242-
elif echo $ch | grep --quiet -E "fmt\.Sprintf" ; then
243-
# Always space after sprintf
244-
err=$(echo $ch | sed -E 's/(fmt\.)(Sprint)f([^%]+) (%s",)([^,]+)/\1\2\3 ",\5/')
245-
elif echo $ch | grep --quiet -E "fmt\." ; then # all other fmt. printers.
246-
err=$(echo $ch | sed -E 's/(fmt\.)(Print|Fprint)f([^%]+) (%[^sTxq]",)([^,]+)/\1\2\3",\5/')
247-
fi
248-
# Trim spaces.
249-
ch=$(echo $ch | xargs)
250-
echo "$file:$line: Please consider avoiding tail format like this:%0A- $ch%0A+ $err"
251-
done |
252-
reviewdog -efm="%f:%l: %m" \
253-
-name="Redundant Format" \
254-
-reporter="github-pr-check" \
255-
-filter-mode="added" \
256-
-fail-on-error="true" \
257-
-level="error"
258-
echo '::endgroup::'
259-
260212
# This is mostly copied from https://github.com/get-woke/woke-action-reviewdog/blob/main/entrypoint.sh
261213
# since their action is not yet released under a stable version.
262214
- name: Language

.github/workflows/knative-verify.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ name: Verify
1919

2020
on:
2121
pull_request:
22-
branches: [ 'master', 'release-*' ]
22+
branches: [ 'main', 'master', 'release-*' ]
2323

2424
jobs:
2525

0 commit comments

Comments
 (0)