ci: add assignee to a PR #1185
Workflow file for this run
This file contains 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: PR Validations | |
on: | |
merge_group: | |
pull_request: | |
types: | |
- opened | |
- edited | |
- synchronize | |
jobs: | |
typos: | |
name: Spell check PR title | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Store PR title in a file | |
shell: bash | |
env: | |
TITLE: ${{ github.event.pull_request.title }} | |
run: echo $TITLE > pr_title.txt | |
- name: Spell check | |
uses: crate-ci/typos@master | |
with: | |
files: ./pr_title.txt | |
check-assignee: | |
name: Check Assignee | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if assignee is added | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const assignees = context.payload.issue ? context.payload.issue.assignees : context.payload.pull_request.assignees; | |
console.log("Assignees:", assignees); | |
if (assignees.length === 0) { | |
throw new Error('No assignee added. Please add an assignee to this issue or pull request.'); | |
} else { | |
console.log("Assignee check passed."); | |
} |