74 lines
2.2 KiB
YAML
74 lines
2.2 KiB
YAML
# This workflow will triage pull requests and apply a label based on the
|
|
# paths that are modified in the pull request.
|
|
#
|
|
# To use this workflow, you will need to set up a .github/labeler.yml
|
|
# file with configuration. For more information, see:
|
|
# https://github.com/actions/labeler/blob/master/README.md
|
|
|
|
name: "Lint ChangeLog"
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- ready_for_review
|
|
- edited
|
|
|
|
permissions:
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
lint-changelog:
|
|
if: ${{ !github.event.pull_request.draft }}
|
|
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Skip ChangeLog lint
|
|
id: skip
|
|
if: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.body, '{no-changelog-lint}') }}
|
|
run: echo "skip=1" >> $GITHUB_OUTPUT
|
|
|
|
- name: Get changes
|
|
if: ${{ !steps.skip.outputs.skip }}
|
|
id: file_changes
|
|
uses: trilom/file-changes-action@v1.2.4
|
|
with:
|
|
output: ","
|
|
|
|
- name: Show modified
|
|
if: ${{ !steps.skip.outputs.skip }}
|
|
run: echo '${{ steps.file_changes.outputs.files_modified}}'
|
|
|
|
- name: Check
|
|
if: ${{ !steps.skip.outputs.skip }}
|
|
id: check
|
|
continue-on-error: true
|
|
run: |
|
|
if [[ "${{ steps.file_changes.outputs.files_modified}}" != *"ChangeLog"* ]]; then
|
|
exit 1
|
|
fi
|
|
|
|
- name: PR comment (no lint hint)
|
|
if: ${{ steps.check.outcome == 'failure' }}
|
|
uses: marocchino/sticky-pull-request-comment@v2
|
|
with:
|
|
header: lint-changelog-tip
|
|
message: |
|
|
❌ `ChangeLog` lint failed: It looks like you didn't add to the `ChangeLog` file.
|
|
|
|
🛠️ Please either add to `ChangeLog` or add `{no-changelog-lint}` to the PR description to skip this check.
|
|
|
|
- name: Delete PR comment
|
|
if: ${{ steps.skip.outputs.skip || steps.check.outcome == 'success' }}
|
|
uses: marocchino/sticky-pull-request-comment@v2
|
|
with:
|
|
header: lint-changelog-tip
|
|
delete: true
|
|
|
|
- name: Fail if no ChangeLog
|
|
if: ${{ steps.check.outcome == 'failure' }}
|
|
run: exit 1
|