github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/.github/workflows/pull-request.yml (about)

     1  name: Pull Request Labeler and Validate
     2  
     3  on:
     4    # Triggers the workflow on pull request context
     5    pull_request_target:
     6      types: [ opened, edited, reopened, synchronize ]
     7  
     8    # Triggers the workflow on issue or pull request comment
     9    #pull_request_review_comment:
    10    issue_comment:
    11  
    12  jobs:
    13    labeler:
    14      name: Labeler
    15      runs-on: ubuntu-latest
    16      steps:
    17        - name: Run multi-labeler
    18          uses: fuxingloh/multi-labeler@v1.5.1
    19          with:
    20            github-token: ${{ secrets.GITHUB_TOKEN }}
    21            config-path: .github/labeler.yml
    22  
    23        - name: Run size-labeler
    24          uses: codelytv/pr-size-labeler@v1
    25          with:
    26            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    27            xs_label: 'size/XS'
    28            xs_max_size: '30'
    29            s_label: 'size/S'
    30            s_max_size: '100'
    31            m_label: 'size/M'
    32            m_max_size: '300'
    33            l_label: 'size/L'
    34            l_max_size: '1000'
    35            xl_label: 'size/XL'
    36            fail_if_xl: 'false'
    37  
    38    validate:
    39      name: Validate PR title
    40      runs-on: ubuntu-latest
    41      steps:
    42        - name: Validate PR title
    43          uses: amannn/action-semantic-pull-request@v5.0.2
    44          env:
    45            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    46          with:
    47            # Configure which types are allowed.
    48            # Default: https://github.com/commitizen/conventional-commit-types
    49            types: |
    50              fix
    51              feat
    52              docs
    53              ci
    54              chore
    55              refactor
    56              test
    57              style
    58              changelog
    59            # Configure that a scope must always be provided.
    60            requireScope: false
    61            # Configure additional validation for the subject based on a regex.
    62            # This example ensures the subject starts with an uppercase character.
    63            subjectPattern: ^[A-Za-z].+$
    64            # If `subjectPattern` is configured, you can use this property to override
    65            # the default error message that is shown when the pattern doesn't match.
    66            # The variables `subject` and `title` can be used within the message.
    67            subjectPatternError: |
    68              The subject "{subject}" found in the pull request title "{title}"
    69              didn't match the configured pattern. Please ensure that the subject
    70              starts with a letter.
    71            # For work-in-progress PRs you can typically use draft pull requests
    72            # from Github. However, private repositories on the free plan don't have
    73            # this option and therefore this action allows you to opt-in to using the
    74            # special "[WIP]" prefix to indicate this state. This will avoid the
    75            # validation of the PR title and the pull request checks remain pending.
    76            # Note that a second check will be reported if this is enabled.
    77            wip: true
    78            # When using "Squash and merge" on a PR with only one commit, GitHub
    79            # will suggest using that commit message instead of the PR title for the
    80            # merge commit, and it's easy to commit this by mistake. Enable this option
    81            # to also validate the commit message for one commit PRs.
    82            validateSingleCommit: false
    83            # If the PR contains one of these labels (newline delimited), the
    84            # validation is skipped.
    85            # If you want to rerun the validation when labels change, you might want
    86            # to use the `labeled` and `unlabeled` event triggers in your workflow.
    87            ignoreLabels: |
    88              ignore-semantic-pull-request