Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ updates:
interval: weekly
day: tuesday
commit-message:
prefix: "chore"
prefix: "chore(ipa)"
53 changes: 53 additions & 0 deletions .github/workflows/ipa-changelog.yml
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
23 changes: 23 additions & 0 deletions .github/workflows/ipa-commit.yml
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
2 changes: 1 addition & 1 deletion .github/workflows/release-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
target_branch: ${{ inputs.branch }}
run_id: ${{ github.run_id }}
with:
commit_message: "(${{env.target_env}}) Release API Changelog :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}."
commit_message: "ci(${{env.target_env}}): Release API Changelog :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}."
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
branch: ${{env.target_branch}}
file_pattern: "changelog/*"
2 changes: 1 addition & 1 deletion .github/workflows/release-spec-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
target_branch: ${{ inputs.branch }}
run_id: ${{ github.run_id }}
with:
commit_message: "(${{env.target_env}}) Release OpenAPI Spec V1 :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}."
commit_message: "ci(${{env.target_env}}): Release OpenAPI Spec V1 :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}."
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
branch: ${{env.target_branch}}
file_pattern: "openapi/v1-deprecated/*"
2 changes: 1 addition & 1 deletion .github/workflows/release-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
target_branch: ${{ inputs.branch }}
run_id: ${{ github.run_id }}
with:
commit_message: "(${{env.target_env}}) Release OpenAPI Spec :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}."
commit_message: "ci(${{env.target_env}}): Release OpenAPI Spec :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}."
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
branch: ${{env.target_branch}}
file_pattern: "openapi/*"
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/semantic-commit.yml
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: |
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
5 changes: 5 additions & 0 deletions tools/spectral/ipa/CHANGELOG.md
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).
Loading
Loading