mirror of https://github.com/knative/caching.git
Update actions (#599)
Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
bd74d8cef1
commit
33800d337f
|
@ -21,13 +21,13 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
branch:
|
branch:
|
||||||
description: 'Branch? (main)'
|
description: 'Branch'
|
||||||
required: true
|
required: true
|
||||||
default: 'main'
|
default: 'main'
|
||||||
start-sha:
|
start-rev:
|
||||||
description: 'Starting SHA? (last tag on branch)'
|
description: 'Start Tag (defaults to merge-base(branch, prev-branch))'
|
||||||
end-sha:
|
end-rev:
|
||||||
description: 'Ending SHA? (latest HEAD)'
|
description: 'End Tag (defaults to HEAD of the target branch)'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-notes:
|
release-notes:
|
||||||
|
@ -44,6 +44,7 @@ jobs:
|
||||||
go-version: 1.17.x
|
go-version: 1.17.x
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
|
# https://github.com/kubernetes/release/tree/master/cmd/release-notes
|
||||||
run: go install k8s.io/release/cmd/release-notes@latest
|
run: go install k8s.io/release/cmd/release-notes@latest
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
|
@ -52,38 +53,45 @@ jobs:
|
||||||
# fetch-depth of 0 indicates all history for all branches and tags.
|
# fetch-depth of 0 indicates all history for all branches and tags.
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Note: Defaults needs to run after we check out the repo.
|
|
||||||
- name: Defaults
|
|
||||||
run: |
|
|
||||||
echo ORG=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}') >> $GITHUB_ENV
|
|
||||||
echo REPO=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}') >> $GITHUB_ENV
|
|
||||||
|
|
||||||
echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
if [[ "${{ github.event.inputs.start-sha }}" != "" ]]; then
|
|
||||||
echo "START_SHA=${{ github.event.inputs.start-sha }}" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
# Default Starting SHA (thanks @dprotaso)
|
|
||||||
export semver=$(git describe --match "v[0-9]*" --abbrev=0)
|
|
||||||
echo "Using ${semver} tag for starting sha."
|
|
||||||
echo START_SHA=$(git rev-list -n 1 "${semver}") >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${{ github.event.inputs.end-sha }}" != "" ]]; then
|
|
||||||
echo "END_SHA=${{ github.event.inputs.end-sha }}" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
# Default Ending SHA (thanks @dprotaso)
|
|
||||||
echo "END_SHA=$(git rev-list -n 1 HEAD)" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Generate Notes
|
- name: Generate Notes
|
||||||
run: |
|
run: |
|
||||||
# See https://github.com/kubernetes/release/tree/master/cmd/release-notes for options.
|
set -x
|
||||||
# Note: we are setting env vars in the Defaults step.
|
# The release-notes tool access ENV vars as options
|
||||||
|
# https://github.com/kubernetes/release/tree/master/cmd/release-notes#options
|
||||||
|
|
||||||
|
export ORG=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')
|
||||||
|
export REPO=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')
|
||||||
|
export BRANCH="${{ github.event.inputs.branch }}"
|
||||||
|
|
||||||
|
export START_REV=${{ github.event.inputs.start-rev }}
|
||||||
|
export END_REV=${{ github.event.inputs.end-rev }}
|
||||||
|
|
||||||
|
if [[ -z "$END_REV" ]]; then
|
||||||
|
END_REV="origin/$BRANCH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If start rev isn't set find the merge base of
|
||||||
|
# the target branch and the previous branch
|
||||||
|
if [[ -z "$START_REV" ]]; then
|
||||||
|
BRANCHES=$(mktemp)
|
||||||
|
# List of branches sorted by semver descending
|
||||||
|
git branch -r -l "origin/release-[0-9]*\.[0-9]*" | sed 's/ //g' | sort -Vr > "$BRANCHES"
|
||||||
|
|
||||||
|
if [[ "$BRANCH" == "main" ]]; then
|
||||||
|
LAST_BRANCH="$(head -n1 "$BRANCHES")"
|
||||||
|
else
|
||||||
|
# use grep magic to find the next branch
|
||||||
|
# '-A 1' - prints the line after the match which we can parse
|
||||||
|
LAST_BRANCH="$(grep -A 1 "$BRANCH" "$BRANCHES" | tail -n1)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export START_SHA=$(git merge-base $LAST_BRANCH origin/$BRANCH)
|
||||||
|
fi
|
||||||
|
|
||||||
release-notes \
|
release-notes \
|
||||||
--required-author "" \
|
--required-author="" \
|
||||||
--repo-path "$(pwd)" \
|
--output=release-notes.md \
|
||||||
--output release-notes.md
|
--repo-path="$PWD" \
|
||||||
|
|
||||||
- name: Display Notes
|
- name: Display Notes
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -48,3 +48,9 @@ jobs:
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v1
|
||||||
|
|
||||||
|
- name: Find Unicode Control Characters
|
||||||
|
uses: pierdipi/unicode-control-characters-action@v0.1.1
|
||||||
|
with:
|
||||||
|
args: -d .
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue