Skip to content

refactor: Cleanup unused deps & remove legacy dApps #761

refactor: Cleanup unused deps & remove legacy dApps

refactor: Cleanup unused deps & remove legacy dApps #761

Workflow file for this run

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@v4
- name: Enable corepack
run: |
corepack enable
corepack prepare [email protected] --activate
yarn set version 4.2.2
- name: Set up Node.js environment
uses: actions/[email protected]
with:
node-version: '>=18.12.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