Skip to content

Commit bb5d34f

Browse files
authored
✨ feature: Create Changelog Changes Check (#42)
* ✨ feature: Create Changelog Changes Check * Update Exit Code Action (for multiple OS's) * Update CHANGELOG.md * Update .jscpd.json to ignore .github * Update README.md * 🧹 chore: [MegaLinter] Apply [1] automatic fixes (#43) Co-authored-by: TylerCarrol <25536704+TylerCarrol@users.noreply.github.com> --------- Co-authored-by: TylerCarrol <25536704+TylerCarrol@users.noreply.github.com>
1 parent fca5772 commit bb5d34f

File tree

5 files changed

+90
-1
lines changed

5 files changed

+90
-1
lines changed

.github/actions/tools/exit-code/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ runs:
4444
message: ${{ steps.createMessage.outputs.result }}
4545

4646
- shell: cmd
47+
if: ${{ runner.os == 'Windows' }}
48+
run: exit ${{ inputs.code }}
49+
50+
- shell: bash
51+
if: ${{ runner.os != 'Windows' }}
4752
run: exit ${{ inputs.code }}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# This workflow ensures that a change was made to the changelog
2+
---
3+
name: Changelog Changed
4+
run-name: >-
5+
${{
6+
format(
7+
'{0} - Changelog Changed{1}',
8+
github.event_name == 'pull_request'
9+
&& format('PR#{0}{1}',github.event.number, github.event.pull_request.draft && ' [DRAFT]' || '')
10+
|| format('Push [{0}]', github.ref_name),
11+
github.event_name == 'pull_request'
12+
&& format(' - [{0}-to-{1}]', github.event.pull_request.head.ref, github.event.pull_request.base.ref)
13+
|| ''
14+
)
15+
}}
16+
17+
on:
18+
pull_request:
19+
branches:
20+
- main
21+
- develop
22+
types:
23+
- opened
24+
- reopened
25+
- synchronize
26+
- ready_for_review
27+
# Trigger if target branch was changed to a trunk
28+
pull_request_target:
29+
types:
30+
- edited
31+
branches:
32+
- main
33+
- develop
34+
35+
concurrency:
36+
group: Changelog-${{ github.event.pull_request.head.ref }}-to-${{ github.event.pull_request.base.ref }}
37+
cancel-in-progress: true
38+
39+
jobs:
40+
checkForChangesToChangelog:
41+
name: Changelog Changed
42+
permissions:
43+
contents: read # Read access to code and content in the repository
44+
pull-requests: read # Read access to pull request metadata for the event
45+
checks: write # Write access to report check results
46+
runs-on: ubuntu-latest
47+
if: ${{ !github.event.pull_request.draft }}
48+
49+
steps:
50+
# Checkout pull request branch
51+
- name: ${{ format('Checkout [{0}]', github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name) }}
52+
uses: actions/checkout@v4
53+
with:
54+
ref: ${{ github.event.pull_request.head.ref }}
55+
token: ${{ secrets.TJC_TOKEN || secrets.GITHUB_TOKEN }}
56+
57+
# Check for Changes in Changelog
58+
- name: Check for Changes to Changelog
59+
id: getChanges
60+
uses: tj-actions/changed-files@v45.0.3
61+
with:
62+
files: CHANGELOG.md
63+
64+
# Report Success
65+
- name: Success - Changelog Changed
66+
if: steps.getChanges.outputs.any_modified == 'true'
67+
uses: ./.github/actions/tools/annotation/notice
68+
with:
69+
message: "[Success] Changelog Changed"
70+
71+
# Report Failure
72+
- name: Failure - Changelog Not Changed
73+
if: steps.getChanges.outputs.any_modified != 'true'
74+
uses: ./.github/actions/tools/exit-code
75+
with:
76+
code: 5
77+
message: "Changelog Not Changed"

.jscpd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"threshold": 0.1,
3-
"ignore": ["*.Tests/**"]
3+
"ignore": ["*.Tests/**", ".github/**"]
44
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Changelog changed check workflow for pr's
13+
1014
## [0.9.2] - 2024-11-10
1115

1216
### Changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[![License](https://img.shields.io/github/license/TJC-Tools/TJC.EnumFlags.svg)](LICENSE)
88

99
[![codecov](https://codecov.io/gh/TJC-Tools/TJC.EnumFlags/graph/badge.svg?token=J5SQ4CYSA9)](https://codecov.io/gh/TJC-Tools/TJC.EnumFlags)
10+
11+
## Documentation
12+
- [Changelog](CHANGELOG.md)

0 commit comments

Comments
 (0)