chore: bump actions/checkout from 4 to 6 #2124
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Validate PR Title' | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize] | |
| jobs: | |
| validate-pr-title: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Enable corepack | |
| run: | | |
| corepack enable | |
| - name: Set up Node.js environment | |
| uses: actions/setup-node@v4.4.0 | |
| with: | |
| node-version: '>=18.18.x' | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Extract PR title | |
| id: extract_pr_title | |
| run: echo "title=$(jq -r '.pull_request.title' $GITHUB_EVENT_PATH)" >> $GITHUB_OUTPUT | |
| - name: Fetch commit messages | |
| id: fetch_commits | |
| run: | | |
| commits=$(jq -r '.pull_request.commits_url' $GITHUB_EVENT_PATH) | |
| curl -s $commits | jq -r '.[].commit.message' > commit_messages.txt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check for release commit | |
| id: check_commit | |
| # Check if any commit message starts with [RELEASE] | |
| run: | | |
| if grep -qE '^\[RELEASE\]' commit_messages.txt; then | |
| echo "contains_release=true" >> $GITHUB_ENV | |
| else | |
| echo "contains_release=false" >> $GITHUB_ENV | |
| fi | |
| - name: Validate PR title | |
| id: check_pr_title | |
| run: | | |
| if [[ "${{ env.contains_release }}" == "true" && ! "${{ steps.extract_pr_title.outputs.title }}" =~ ^\[RELEASE\] ]]; then | |
| echo "PR title must start with [RELEASE] if any commit starts with [RELEASE]." | |
| exit 1 | |
| else | |
| echo "${{ steps.extract_pr_title.outputs.title }}" | yarn commitlint --verbose | |
| fi |