Skip to content

docs: adds commit guidelines #419

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

docs: adds commit guidelines #419

wants to merge 1 commit into from

Conversation

latin-panda
Copy link
Collaborator

I have verified this PR works in these browsers (latest versions):

  • Chrome
  • Firefox
  • Safari (macOS)
  • Safari (iOS)
  • Chrome for Android
  • Not applicable

What else has been done to verify that this works as intended?

NA

Why is this the best possible solution? Were any other approaches considered?

NA

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

NA

Do we need any specific form for testing your changes? If so, please attach one.

NA

What's changed

  • Adds contributor guidelines section, focusing in commit messages and later can be expanded to more topics

Copy link

changeset-bot bot commented May 22, 2025

⚠️ No Changeset found

Latest commit: 73f5a6a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

- **Body**: Optional, lists specific changes (e.g., `- add geopoint.xml demo form`).
- **Footer**: Use `Co-authored-by: @<username>` or `BREAKING CHANGE:` for automation.

Our commit message format enables automated release management. This standard ensures commits are categorized to trigger appropriate version bumps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this is managed by changeset so this section doesn't feel relevant. Changeset makes sense in our context because the version bumps aren't always the same across packages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see a benefit in having a format for commit messages?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find that prefixes make the commit history easier to understand and scan visually. But I may be biased from using them for years

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be interesting to tag and publish the packages when the prep PR is merged, based on a commit:

release: pack version and publish

Copy link
Collaborator Author

@latin-panda latin-panda May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself - try this out later:

name: Tag packages for release

on:
  pull_request:
    types: [closed]
    branches:
      - main

jobs:
  tag-packages:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      # Checkout the repository with full history
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          # Use a Personal Access Token to push tags (required for protected branches)
          token: ${{ secrets.PAT }}

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Check commit message
        id: check_commit
        run: |
          COMMIT_MESSAGE=$(git log --pretty=%B -1 ${{ github.event.pull_request.merge_commit_sha }})
          echo "Commit message: $COMMIT_MESSAGE"
          if echo "$COMMIT_MESSAGE" | grep -q "^release:"; then
            echo "Release commit detected"
            echo "is_release=true" >> $GITHUB_OUTPUT
          else
            echo "No release commit detected"
            echo "is_release=false" >> $GITHUB_OUTPUT
          fi

      - name: Configure git
        if: steps.check_commit.outputs.is_release == 'true'
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"

      - name: Tag packages
        if: steps.check_commit.outputs.is_release == 'true'
        run: |
          # Array of package directories
          PACKAGES=(
            "packages/web-forms"
            "packages/xforms-engine"
            "packages/xpath"
            "packages/tree-sitter-xpath"
          )

          for PKG in "${PACKAGES[@]}"; do
            NAME=$(node -p "require('./$PKG/package.json').name")
            VERSION=$(node -p "require('./$PKG/package.json').version")
            TAG="$NAME@$VERSION"

            if git tag | grep -Fx "$TAG"; then
              echo "Tag $TAG already exists, skipping..."
            else
              echo "Creating tag $TAG for $NAME"
              git tag "$TAG"
            fi
          done

          # Push all new tags
          git push origin --tags


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind the prefixes and happy to follow your lead there as long as we keep changeset for versioning and changelog management for now. I like the future idea of automating tag and release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants