Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release notes workflow #4088

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/actions/fetch-prs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Fetch PRs
description: Fetch PRs from the Kibana repository and update the release notes draft
inputs:
target-repo:
description: 'elastic/kibana'
required: true
default: 'elastic/kibana'
runs:
using: 'node12'
main: 'index.js'
31 changes: 31 additions & 0 deletions .github/actions/fetch-prs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const core = require('@actions/core');
const github = require('@actions/github');
const fs = require('fs');

async function run() {
try {
const targetRepo = core.getInput('elastic/kibana');
const [owner, repo] = targetRepo.split('/');
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);

const { data: pulls } = await octokit.pulls.list({
owner,
repo,
state: 'closed',
});

let releaseNotes = '## Changes from ' + targetRepo + '\n\n';
for (const pr of pulls) {
if (pr.merged_at) {
releaseNotes += `- ${pr.title} (#${pr.number}) by @${pr.user.login}\n`;
}
}

fs.writeFileSync('release-notes.asciidoc', releaseNotes);
core.setOutput('release-notes', releaseNotes);
} catch (error) {
core.setFailed(error.message);
}
}

run();
35 changes: 35 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name-template: 'v$NEXT_PATCH_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'
change-template: '* $TITLE ({$URL[#$NUMBER])'
exclude-labels:
- 'release_note:skip'
- 'Team:Docs'
- 'reverted'
- 'backport'
include-labels:
- 'Feature:Uptime'
- 'Feature:Logs UI'
- 'Team:apm'
- 'Team:APM'
- 'Feature:Metrics UI'
- 'Team:logs-metrics-ui'
- 'Feature:Observability Home'
- 'Team:obs-ux-management'
- 'Team:Obs AI Assistant'
- 'Feature:SLO'
categories:
- title: 'Breaking changes'
collapse-after: 5
labels: ['release_note:breaking']
- title: 'Features and enhancements'
collapse-after: 5
labels: ['release_note:feature', 'release_note:enhancement']
- title: 'Bug fixes'
collapse-after: 5
labels: ['release_note:fix']
template: |
== Elastic {observability}

$CHANGES

To view all changes, check https://github.com/$OWNER/$REPO/compare/$PREVIOUS_TAG...$CURRENT_TAG.
46 changes: 46 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release notes drafter

on:
push:
branches:
- main
pull_request:
types: [ closed ]
workflow_dispatch:

permissions:
contents: read

jobs:
update_release_draft:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Fetch PRs from another repository
id: fetch_prs
uses: ./.github/actions/fetch-prs
with:
target-repo: 'elastic/kibana'

- name: Run release notes drafter
id: drafter
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update release notes
run: echo "${{ steps.fetch_prs.outputs.release-notes }}" >> release-notes.asciidoc

- name: Create release
uses: actions/create-release@v1
with:
tag_name: ${{ github.event.release.tag_name }}
release_name: ${{ github.event.release.tag_name }}
body_path: release-notes.asciidoc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading