Skip to content

Commit 0bd9464

Browse files
Update common github actions (#151)
Signed-off-by: Knative Automation <[email protected]>
1 parent 961e1a9 commit 0bd9464

File tree

3 files changed

+100
-2
lines changed

3 files changed

+100
-2
lines changed

.github/workflows/knative-releasability.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
# The following pushes the stdout of buoy into $CHECK_MESSAGE
8181
CHECK=0
8282
echo 'CHECK_MESSAGE<<EOF' >> $GITHUB_ENV
83-
buoy check go.mod --release ${RELEASE} --domain knative.dev --verbose >> $GITHUB_ENV || CHECK=$?
83+
buoy check go.mod --release ${RELEASE} --domain knative.dev --verbose >> $GITHUB_ENV 2>&1 || CHECK=$?
8484
echo 'EOF' >> $GITHUB_ENV
8585
8686
# We just captured the return code of the buoy call, test it to see
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Copyright 2020 The Knative Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This file is automagically synced here from github.com/knative-sandbox/.github
16+
# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten.
17+
18+
name: 'Release Notes'
19+
20+
on:
21+
workflow_dispatch:
22+
inputs:
23+
branch:
24+
description: 'Branch? (master)'
25+
required: true
26+
default: 'master'
27+
start-sha:
28+
description: 'Starting SHA? (last tag on branch)'
29+
end-sha:
30+
description: 'Ending SHA? (latest HEAD)'
31+
32+
jobs:
33+
release-notes:
34+
name: Release Notes
35+
runs-on: 'ubuntu-latest'
36+
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
steps:
41+
- name: Set up Go
42+
uses: actions/setup-go@v2
43+
with:
44+
go-version: 1.15.x
45+
46+
- name: Install Dependencies
47+
run: GO111MODULE=on go get k8s.io/release/cmd/release-notes
48+
49+
- name: Check out code
50+
uses: actions/checkout@v2
51+
with:
52+
# fetch-depth of 0 indicates all history for all branches and tags.
53+
fetch-depth: 0
54+
55+
# Note: Defaults needs to run after we check out the repo.
56+
- name: Defaults
57+
run: |
58+
echo ORG=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}') >> $GITHUB_ENV
59+
echo REPO=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}') >> $GITHUB_ENV
60+
61+
echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
62+
63+
if [[ "${{ github.event.inputs.start-sha }}" != "" ]]; then
64+
echo "START_SHA=${{ github.event.inputs.start-sha }}" >> $GITHUB_ENV
65+
else
66+
# Default Starting SHA (thanks @dprotaso)
67+
export semver=$(git describe --match "v[0-9]*" --abbrev=0)
68+
echo "Using ${semver} tag for starting sha."
69+
echo START_SHA=$(git rev-list -n 1 "${semver}") >> $GITHUB_ENV
70+
fi
71+
72+
if [[ "${{ github.event.inputs.end-sha }}" != "" ]]; then
73+
echo "END_SHA=${{ github.event.inputs.end-sha }}" >> $GITHUB_ENV
74+
else
75+
# Default Ending SHA (thanks @dprotaso)
76+
echo "END_SHA=$(git rev-list -n 1 HEAD)" >> $GITHUB_ENV
77+
fi
78+
79+
- name: Generate Notes
80+
run: |
81+
# See https://github.com/kubernetes/release/tree/master/cmd/release-notes for options.
82+
# Note: we are setting env vars in the Defaults step.
83+
release-notes \
84+
--required-author "" \
85+
--repo-path "$(pwd)" \
86+
--output release-notes.md
87+
88+
- name: Display Notes
89+
run: |
90+
cat release-notes.md
91+
92+
- name: Archive Release Notes
93+
uses: actions/upload-artifact@v2
94+
with:
95+
name: release-notes.md
96+
path: release-notes.md

.github/workflows/knative-style.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ jobs:
245245
elif echo $ch | grep --quiet -E "fmt\." ; then # all other fmt. printers.
246246
err=$(echo $ch | sed -E 's/(fmt\.)(Print|Fprint)f([^%]+) (%[^sTxq]",)([^,]+)/\1\2\3",\5/')
247247
fi
248-
echo "$file:$line: Please consider avoiding tail format like this:%0A$err"
248+
# Trim spaces.
249+
ch=$(echo $ch | xargs)
250+
echo "$file:$line: Please consider avoiding tail format like this:%0A- $ch%0A+ $err"
249251
done |
250252
reviewdog -efm="%f:%l: %m" \
251253
-name="Redundant Format" \

0 commit comments

Comments
 (0)