From 58b7aeb3933a648b453d29446d7ac82e1524c6f1 Mon Sep 17 00:00:00 2001 From: Knative Automation Date: Thu, 4 Feb 2021 13:53:41 +0000 Subject: [PATCH] Update common github actions Signed-off-by: Knative Automation --- .github/workflows/knative-releasability.yaml | 10 +++++--- .github/workflows/knative-style.yaml | 25 ++++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/knative-releasability.yaml b/.github/workflows/knative-releasability.yaml index ca0820a6e..cecf0a52f 100644 --- a/.github/workflows/knative-releasability.yaml +++ b/.github/workflows/knative-releasability.yaml @@ -36,8 +36,8 @@ jobs: env: ######################################### # Update this section each release. # - RELEASE: 'v0.19' - SLACK_CHANNEL: 'release-19' + RELEASE: 'v0.20' + SLACK_CHANNEL: 'release-20' ######################################### steps: @@ -50,6 +50,9 @@ jobs: if [[ "${{ github.event.inputs.slackChannel }}" != "" ]]; then echo "SLACK_CHANNEL=${{ github.event.inputs.slackChannel }}" >> $GITHUB_ENV fi + if [[ "${{ secrets.SLACK_WEBHOOK }}" != "" ]]; then + echo "SLACK_WEBHOOK=exists" >> $GITHUB_ENV + fi - name: Set up Go 1.15.x uses: actions/setup-go@v2 @@ -142,7 +145,8 @@ jobs: echo 'SLACK_TITLE=Releasability for ${{ github.repository }} @ ${{ env.RELEASE }} is NO-GO!' >> $GITHUB_ENV - name: Post status to Slack - if: ${{ secrets.SLACK_WEBHOOK != '' && steps.exists.outputs.release-branch == 'false' }} + # Note: using env.SLACK_WEBHOOK here because secrets are not allowed in the if block. + if: env.SLACK_WEBHOOK != '' && steps.exists.outputs.release-branch == 'false' uses: rtCamp/action-slack-notify@v2.1.0 env: SLACK_ICON: http://github.com/knative.png?size=48 diff --git a/.github/workflows/knative-style.yaml b/.github/workflows/knative-style.yaml index 3c7f28dde..4e0947a9b 100644 --- a/.github/workflows/knative-style.yaml +++ b/.github/workflows/knative-style.yaml @@ -127,7 +127,7 @@ jobs: if: steps.golangci_configuration.outputs.files_exists == 'true' uses: golangci/golangci-lint-action@v2 with: - version: v1.32 + version: v1.35 - name: misspell shell: bash @@ -141,7 +141,12 @@ jobs: echo '::group:: Running github.com/client9/misspell with reviewdog 🐶 ...' # Don't fail because of misspell set +o pipefail - find . -type f -not -path './vendor/*' -not -path './third_party/*' -not -path './.git/*' | + # Exclude generated and vendored files, plus some legacy + # paths until we update all .gitattributes + git ls-files | + git check-attr --stdin linguist-generated | grep -Ev ': (set|true)$' | cut -d: -f1 | + git check-attr --stdin linguist-vendored | grep -Ev ': (set|true)$' | cut -d: -f1 | + grep -Ev '^(vendor/|third_party/|.git)' | xargs misspell -error | reviewdog -efm="%f:%l:%c: %m" \ -name="github.com/client9/misspell" \ @@ -164,7 +169,13 @@ jobs: echo '::group:: Flagging trailing whitespace with reviewdog 🐶 ...' # Don't fail because of grep set +o pipefail - find . -type f -not -path './vendor/*' -not -path './third_party/*' -not -path './.git/*' | + + # Exclude generated and vendored files, plus some legacy + # paths until we update all .gitattributes + git ls-files | + git check-attr --stdin linguist-generated | grep -Ev ': (set|true)$' | cut -d: -f1 | + git check-attr --stdin linguist-vendored | grep -Ev ': (set|true)$' | cut -d: -f1 | + grep -Ev '^(vendor/|third_party/|.git)' | xargs grep -nE " +$" | reviewdog -efm="%f:%l:%m" \ -name="trailing whitespace" \ @@ -192,7 +203,13 @@ jobs: # - nothing in third_party # - nothing in .git/ # - no *.ai (Adobe Illustrator) files. - for x in $(find . -type f -not -name '*.ai' -not -path './vendor/*' -not -path './third_party/*' -not -path './.git/*'); do + LINT_FILES=$(git ls-files | + git check-attr --stdin linguist-generated | grep -Ev ': (set|true)$' | cut -d: -f1 | + git check-attr --stdin linguist-vendored | grep -Ev ': (set|true)$' | cut -d: -f1 | + grep -Ev '^(vendor/|third_party/|.git)' | + grep -v '\.ai$') + + for x in $LINT_FILES; do # Based on https://stackoverflow.com/questions/34943632/linux-check-if-there-is-an-empty-line-at-the-end-of-a-file if [[ -f $x && ! ( -s "$x" && -z "$(tail -c 1 $x)" ) ]]; then # We add 1 to `wc -l` here because of this limitation (from the man page):