Skip to content

fix(checks): Pin action version to SHA #439

fix(checks): Pin action version to SHA

fix(checks): Pin action version to SHA #439

Workflow file for this run

name: Validate PR title
on:
pull_request:
types: [opened, edited, synchronize]
branches: [main]
workflow_call: {}
# Disable permissions for all available scopes
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
validate-pr-title:
permissions:
pull-requests: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Validate PR title conforms to conventional spec
id: validate-pr-title
uses: amannn/action-semantic-pull-request@47b15d52c5c30e94a17ec87eb8dd51ff5221fed9 # v5.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add PR comment on failure
if: ${{ always() && steps.validate-pr-title.outputs.error_message != null }}
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
header: pr-title-error
message: |
Pull request titles should follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like the proposed title needs to be adjusted.
Details:
```
${{ steps.validate-pr-title.outputs.error_message }}
```
- name: Delete PR comment on resolution
if: ${{ always() && steps.validate-pr-title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
header: pr-title-error
delete: true
- name: Summary with valid title
if: ${{ always() && steps.validate-pr-title.outputs.error_message == null }}
run: |
echo "### :white_check_mark: Pull Request title is valid" >> $GITHUB_STEP_SUMMARY
echo "The pull request title conforms to the conventional commit specification." >> $GITHUB_STEP_SUMMARY
- name: Summary without invalid title
if: ${{ always() && steps.validate-pr-title.outputs.error_message != null }}
run: |
echo "### :bangbang: Pull Request title is invalid" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The pull request title does not conform to the conventional commit specification." >> $GITHUB_STEP_SUMMARY
echo "${{ steps.validate-pr-title.outputs.error_message }}" >> $GITHUB_STEP_SUMMARY