Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickjahns committed Mar 1, 2020
1 parent d16ebdc commit 265d52d
Show file tree
Hide file tree
Showing 32 changed files with 9,426 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage
14 changes: 14 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": ["eslint:recommended", "prettier"],
"plugins": ["prettier"],
"parserOptions": {
"ecmaVersion": 9
},
"env": { "node": true, "es6": true },
"rules": {
"prettier/prettier": "warn",
"no-console": "off",
"no-unused-vars": "warn"
},
"ignorePatterns": ["dist/"]
}
29 changes: 29 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name-template: 'v$NEXT_PATCH_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'
template: |
$CHANGES
categories:
- title: 'Added'
labels:
- 'enhancement'
- title: 'Fixed'
labels:
- 'bug'
- title: 'Changed'
labels:
- 'changed'
- title: 'Deprecated'
labels:
- 'deprecation'
- title: 'Removed'
labels:
- 'removed'
- title: 'Security'
labels:
- 'security'
- title: 'Documentation'
labels:
- 'documentation'
- title: 'Dependency Updates'
labels:
- 'dependencies'
69 changes: 69 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
repository:
name: chlgr
description: 📃 Github Action that creates a changelog and provides the content via pull requests to be merged for a future release
topics: changelog, changelog-generator, github-changelog-generator, action, github-action

private: false
has_issues: true
has_projects: false
has_wiki: false
has_downloads: false

default_branch: master

allow_squash_merge: true
allow_merge_commit: true
allow_rebase_merge: true
delete_branch_on_merge: true

labels:
- name: bug
color: d73a4a
description: Something isn't working
- name: documentation
color: 0075ca
description: Improvements or additions to documentation
- name: duplicate
color: cfd3d7
description: This issue or pull request already exists
- name: enhancement
color: a2eeef
description: New feature or request
- name: good first issue
color: 7057ff
description: Good for newcomers
- name: help wanted
color: 008672
description: Extra attention is needed
- name: invalid
color: e4e669
description: This doesn't seem right
- name: question
color: d876e3
description: Further information is requested
- name: wontfix
color: ffffff
description: This will not be worked on
- name: dependencies
color: 0366d6
description: Pull requests that update a dependency file
- name: security
description: Security relevant changes
- name: removed
description: Functionality that has been removed
- name: deprecation
description: Functionality that has been deprecated
- name: changed
description: Functionality that has been changed
- name: semver:patch
color: 834dd1
description: Change leading to a patch level version bump
- name: semver:minor
color: 764ab5
description: Change leading to a minor level version bump
- name: semver:major
color: 6b3bad
description: A (breaking) change leading to a major version bump

...
14 changes: 14 additions & 0 deletions .github/workflows/actions-tagger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Keep github major version up-to-date
on:
release:
types: [published]

jobs:
actions-tagger:
runs-on: ubuntu-latest
steps:
- uses: Actions-R-Us/actions-tagger@latest
with:
publish_latest: true
env:
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
58 changes: 58 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: test
on: [push, pull_request]


jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: prepare env
run: npm install
- name: lint
run: npm run lint
- name: test
run: npm run test

test-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: prepare env
run: npm install
- name: built
run: npm run build
- name: dry-run
id: changelog
uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: 'true'

dist:
needs:
- unit-test
- test-action
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: prepare env
run: npm install
- name: built
run: npm run build
- name: update readme
run: npm run gendocs
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4.0.0
with:
commit_message: 'updated dist files'
14 changes: 14 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release Drafter

on:
push:
branches:
- master

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
npm-debug.log
*.pem
.env
coverage
dist/**
dist/index.js
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"bracketSpacing": true
}
107 changes: 106 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,106 @@
# chlgr
# chlgr
![test](https://github.com/patrickjahns/chlgr/workflows/test/badge.svg?branch=master&style=flat)
![license](https://img.shields.io/github/license/patrickjahns/chlgr)

Creates a changelog and provides the content via pull requests to be merged for a release

## Introduction

This action provides the functionality of [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator) to easily and automatically manage a human readable changelog.
chlgr differentiates itself from other changelog actions, by managing the changelog in a separate branch and as well as maintaining and creating a pull request with the changelog.

The rationale behind here is, that released artifacts should contain a up-to-date changelog with the correct version set.


## Usage

<!-- start usage -->
```yaml
- uses: patrickjahns/chlgr@v1
with:
# A prefix to be used for the commit msg and pr title
# Default: [RELEASE]
commit-msg-prefix: ''

# The filename of the changelog
# Default: CHANGELOG.md
changelog-file: ''

# The base for the pull-request chlgr creates
# Default: master
base-branch: ''

# The branch used by chlgr for pushing the changelog and basing the pull request
# off towards `base-branch`
# Default: release/next
release-branch: ''

# If provided, this will be used as version for the changelog and the pull request
# title
# Default: unknown
release-version: ''

# If set, the action will not push the changelog or create a pull request
dry-run: ''

# Auth token used to push the changes back to github and create the pull request
# with. [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
# Default: ${{ github.token }}
token: ''
```
<!-- end usage -->
## Examples
### Basic example
```yaml
name: Update Changelog
on:
push:
branches:
- master

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: update changelog
uses: patrickjahns/chlgr@v1
```
### Passing a version to the action
```yaml
name: Update Changelog
on:
push:
branches:
- master

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: calculate next version
id: version
uses: patrickjahns/version-drafter-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: update changelog
uses: patrickjahns/chlgr@v1
with:
release-version: ${{ steps.version.outputs.next-version }}
```
## Extended configuration
This action utilizes [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator) therefor all [configuration options](https://github.com/github-changelog-generator/github-changelog-generator/wiki/Advanced-change-log-generation-examples)
are also applicable for this action by creating a [`.github_changelog_generator` params file](https://github.com/github-changelog-generator/github-changelog-generator#params-file).

## License

The scripts and documentation in this project are released under the [MIT License](LICENSE)
45 changes: 45 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'chlgr'
description: 'Creates a changelog and provides the content via pull requests to be merged for a future release'

inputs:
commit-msg-prefix:
description: 'A prefix to be used for the commit msg and pr title'
default: '[RELEASE]'
required: false
changelog-file:
description: 'The filename of the changelog'
required: false
default: 'CHANGELOG.md'
base-branch:
description: 'The base for the pull-request chlgr creates'
default: 'master'
required: false
release-branch:
description: >
The branch used by chlgr for pushing the changelog and basing
the pull request off towards `base-branch`
default: 'release/next'
required: false
release-version:
description: >
If provided, this will be used as version for the changelog and
the pull request title
default: 'unknown'
required: false
dry-run:
description: 'If set, the action will not push the changelog or create a pull request'
required: false
token:
description: >
Auth token used to push the changes back to github and create the pull request with.
[Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
default: ${{ github.token }}
required: false

runs:
using: 'node12'
main: 'dist/index.js'

branding:
icon: trending-up
color: orange
Loading

0 comments on commit 265d52d

Please sign in to comment.