Skip to content

Commit

Permalink
Adding release note generator action based on k8s release notes gener…
Browse files Browse the repository at this point in the history
…ator tool

Signed-off-by: Scott Nichols <[email protected]>
  • Loading branch information
Scott Nichols committed May 24, 2021
1 parent e64ec6b commit 9bbd741
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Fixes #

<!-- Please include the 'why' behind your changes if no issue exists -->

## Proposed Changes

-
-
-

**Release Note**

<!--
If this change has user-visible impact, write a release note in the block
below. If this change has no user-visible impact, no release note is needed.
-->

```release-note
```
91 changes: 91 additions & 0 deletions .github/workflows/release-notes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Copyright 2021 The CloudEvents Authors.
# Copyright 2020 The Knative Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'Release Notes'

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch? (master)'
required: true
default: 'master'
start-sha:
description: 'Starting SHA? (last tag on branch)'
end-sha:
description: 'Ending SHA? (latest HEAD)'

jobs:
release-notes:
name: Release Notes
runs-on: 'ubuntu-latest'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Set up Go
uses: actions/setup-go@v2

- name: Install Dependencies
run: GO111MODULE=on go get k8s.io/release/cmd/release-notes

- name: Check out code
uses: actions/checkout@v2
with:
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
run: |
# See https://github.com/kubernetes/release/tree/master/cmd/release-notes for options.
# Note: we are setting env vars in the Defaults step.
release-notes \
--required-author "" \
--repo-path "$(pwd)" \
--output release-notes.md
- name: Display Notes
run: |
cat release-notes.md
- name: Archive Release Notes
uses: actions/upload-artifact@v2
with:
name: release-notes.md
path: release-notes.md

0 comments on commit 9bbd741

Please sign in to comment.