babarot / changelog-empty-check-action

Repository from Github https://github.combabarot/changelog-empty-check-actionRepository from Github https://github.combabarot/changelog-empty-check-action

Empty Changelog Check Action

A GitHub Action that checks for empty changelog entries in pull requests.

Features

  • Detects newly added changelog entries without content
  • Adds a customizable label to PRs with empty changelog entries
  • Provides detailed output about empty entries
  • Adds customizable comments for warnings and success states
  • Supports customization through inputs

Usage

- uses: babarot/changelog-empty-check-action@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    pull-request-number: ${{ github.event.pull_request.number }}
    label-name: 'empty-changelog'  # optional
    warning-message: '🚨 Empty changelog entries detected'  # optional
    success-message: 'βœ… Changelog entry has been filled'  # optional

Inputs

Name Description Required Default
github-token GitHub token for API operations Yes ${{ github.token }}
pull-request-number Number of the pull request to check Yes N/A
label-name Label to add when empty changelog is detected No empty-changelog
warning-message Message to comment when empty changelog is detected No ''
success-message Message to comment when changelog is filled No ''

Outputs

Name Description
has_empty_changelog Whether empty changelog entries were found ('true' or 'false')
empty_headers Newline-separated list of empty changelog headers

Example

Case 1

name: Check Empty Changelog

on:
  pull_request:
    paths:
      - 'CHANGELOG.md'

jobs:
  check-changelog:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: babarot/changelog-empty-check-action@v1
        id: check
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          pull-request-number: ${{ github.event.pull_request.number }}
          label-name: 'empty-changelog'
          warning-message: '🚨 Please add content to the empty changelog entries'
          success-message: 'βœ… Thanks for updating the changelog!'

Case 2: Use together with tagpr

jobs:
  tagpr:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    permissions:
      contents: write
      pull-requests: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Run tagpr
        uses: Songmu/tagpr@v1.5.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        id: run-tagpr
      - name: Check for empty changelog entries
        if: steps.run-tagpr.outputs.pull_request != ''
        uses: babarot/changelog-empty-check-action@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          label-name: changelog-missing
          pull-request-number: ${{ fromJSON(steps.run-tagpr.outputs.pull_request).number }}

Development

  1. Clone the repository
  2. Install dependencies: npm install
  3. Make changes in src/
  4. Run tests: npm test
  5. Build: npm run build

License

MIT

Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

About


Languages

Language:TypeScript 98.3%Language:JavaScript 1.7%