-
Notifications
You must be signed in to change notification settings - Fork 14
feat(ipa): Commit checks and IPA changelog #852
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b90c3b7
Draft semantic commit check
5eff38e
Fix releases to use semantic commits
4fe87cc
Alter commit messages for new convention
9e9512c
Changelog config
7617cb8
init changelog
99675b3
Draft ipa commit check
e087de7
Refined ipa commit check
adcd848
fix package version
f1f5c6c
Draft IPA changelog check
c94c84e
bump version for testing
1f3a8ea
fix versiom bump logic
ac8b79f
attempt fix jq logic
107d123
Try different approach for version fetch
d149ddd
Correct directory
0467765
Correct directory + time save on version fetch
a37fd54
Correct package version
ec7846d
refactor for linting
fd750fe
Pin semantic comment version w/ sha
6c61102
Update .github/workflows/semantic-commit.yml
sphterry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,4 @@ updates: | |
interval: weekly | ||
day: tuesday | ||
commit-message: | ||
prefix: "chore" | ||
prefix: "chore(ipa)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: IPA Changelog Check | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, edited] | ||
paths: | ||
- 'tools/spectral/ipa/package.json' | ||
|
||
jobs: | ||
check-changelog: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | ||
with: | ||
sparse-checkout: | | ||
tools/spectral/ipa | ||
|
||
- name: Fetch Versions | ||
working-directory: tools/spectral/ipa | ||
id: version_check | ||
run: | | ||
current_version=$(jq '.version' package.json) | ||
echo "Current version: $current_version" | ||
|
||
previous_version=$(git show origin/${{ github.event.pull_request.base.ref }}:tools/spectral/ipa/package.json | jq -r '.version') | ||
|
||
if [[ -z "$previous_version" || "$previous_version" == "null" ]]; then | ||
previous_version="none" | ||
fi | ||
echo "Previous version: $previous_version" | ||
|
||
- name: Check Changelog | ||
working-directory: tools/spectral/ipa | ||
env: | ||
VERSION_BUMP: ${{ steps.version_check.outputs.current_version != steps.version_check.outputs.previous_version && 'true' || 'false' }} | ||
run: | | ||
npm run gen-ipa-changelog | ||
|
||
# Check for uncommitted changes specific to CHANGELOG.md | ||
uncommitted_changes=$(git status --porcelain | grep "CHANGELOG.md" || echo "") | ||
|
||
if [[ "$VERSION_BUMP" == "false" && -n "$uncommitted_changes" ]]; then | ||
echo "Error: Changelog should only be updated alongside a version bump. Please restore the changelog." | ||
exit 1 | ||
fi | ||
|
||
if [[ "$VERSION_BUMP" == "true" && -z "$uncommitted_changes" ]]; then | ||
echo "Error: Changelog must be updated alongside a version bump. Please run 'npm run gen-ipa-changelog' from the ipa directory and commit the changes." | ||
exit 1 | ||
fi | ||
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: IPA Commit Check | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, edited] | ||
paths: | ||
- 'tools/spectral/ipa/**' | ||
|
||
jobs: | ||
check-pr-title: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Validate PR Title with IPA scope | ||
env: | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
run: | | ||
PATTERN="^[a-z]+\(ipa\): .+$" | ||
if [[ ! "$PR_TITLE" =~ $PATTERN ]]; then | ||
echo "PR title must follow the conventional commit format with (ipa) as the scope." | ||
echo "Example: feat(ipa): My New Rule" | ||
exit 1 | ||
fi | ||
andreaangiolillo marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Semantic Commit Check | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, edited] | ||
|
||
jobs: | ||
semantic-commit: | ||
runs-on: ubuntu-latest | ||
name: Check Semantic PRs titles | ||
steps: | ||
- name: Check PR title | ||
uses: amannn/action-semantic-pull-request@335288255954904a41ddda8947c8f2c844b8bfeb | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
types: | | ||
sphterry marked this conversation as resolved.
Show resolved
Hide resolved
|
||
feat | ||
fix | ||
docs | ||
style | ||
refactor | ||
perf | ||
test | ||
build | ||
ci | ||
chore | ||
revert | ||
scopes: | | ||
ipa | ||
prod | ||
requireScope: false | ||
subjectPattern: "^[A-Z].+[^.]$" | ||
subjectPatternError: | | ||
The subject "{subject}" found in the pull request title "{title}" | ||
didn't match the configured pattern. Please ensure that the subject | ||
starts with an uppercase letter and doesn't end with a period. | ||
validateSingleCommit: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### Changelog | ||
|
||
All notable changes to this project will be documented in this file. Dates are displayed in UTC. | ||
|
||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.