Skip to content

Commit

Permalink
work with changelogs
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankatliarchuk committed Apr 5, 2021
1 parent 41b5326 commit 2254c87
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 8 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ on:
workflow_dispatch:
schedule:
- cron: "20 23 * * *"
push:
tags:
- 'v*'
branches:
- main
paths-ignore:
- "README.md"
- "CHANGELOG.md"

env:
BRANCH: main
Expand Down
112 changes: 112 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,115 @@ jobs:
tag: ${{ needs.update-tag.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update-changelog:
runs-on: ubuntu-latest
needs: [ release ]
name: changelog generator
timeout-minutes: 5
if: ${{ !contains(github.event.head_commit.message, 'skip') && needs.update-tag.outputs.draft && github.ref == 'refs/heads/main' }}
steps:
# To use this repository's private action, you must check out the repository
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 30
submodules: 'true'

# https://github.com/marketplace/actions/tag-changelog
- name: create changelog text
uses: loopwerk/conventional-changelog-action@latest
id: ch
with:
token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/tag-changelog-config.js

- name: read 'templates/changelog.history'
id: ch-history
uses: juliangruber/read-file-action@v1
with:
path: .github/templates/changelog.history

- name: read 'templates/changelog'
id: ch-template
uses: juliangruber/read-file-action@v1
with:
path: .github/templates/changelog

- name: write to changelog.md
uses: DamianReeves/write-file-action@master
with:
path: CHANGELOG.md
contents: |
${{ steps.ch-template.outputs.content }}${{ steps.ch.outputs.changelog }}${{ steps.ch-history.outputs.content }}
write-mode: overwrite

- name: write to 'templates/changelog.history'
uses: DamianReeves/write-file-action@master
with:
path: .github/templates/changelog.history
contents: |
${{ steps.ch.outputs.changelog }}${{ steps.ch-history.outputs.content }}
write-mode: overwrite

- name: check local changes
id: diff
run: |
changed_files=$(git status --porcelain --untracked-files=all | wc -l)
echo ::set-output name=count::$changed_files
echo ::set-output name=created::$(date)
shell: bash

- name: Bump version and push tag
uses: anothrNick/[email protected]
id: tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: true

-
name: create pull request
uses: peter-evans/create-pull-request@v3
id: cpr
if: ${{ steps.ch.outputs.changes }}
with:
branch: docs/changelog
base: ${{ github.head_ref }}
delete-branch: true
labels: |
kind/docs
:memo: documentation
:memo: docs
:bell: approved
:bell: automerge
:robot: bot
committer: ${{ env.COMMITTER_BOT }}
author: ${{ env.AUTHOR_BOT }}
title: |
"docs: update changelog "${{ steps.tag.outputs.tag }} #${{ github.run_number }}" '
commit-message: |
'docs: Update CHANGELOG.md "${{ github.workflow }} #${{ github.run_number }}" [skip ci]'
body: |
## Description
Update CHANGELOG.md
${{ steps.changelog.outputs.changelog }}
## Update report workflow
- Updated with *today's* date **`${{ steps.diff.outputs.created }}`**
- Current Tag: **`${{ steps.tag.outputs.tag }}`**
- Name: **${{ github.workflow }}**
- Run ID: **${{ github.run_id }}**
- Run Number: **${{ github.run_number }}**
_Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
- name: check outputs
if: ${{ steps.changelog.outputs.changes }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

0 comments on commit 2254c87

Please sign in to comment.