This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
Upgrade Workflows/Actions #14
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: LGTM Check | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
check-comments: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for LGTM comment | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const issue_number = context.issue.number; | |
const owner = context.repo.owner; | |
const repo = context.repo.repo; | |
const pull_request = await github.rest.pulls.get({ | |
owner: owner, | |
repo: repo, | |
pull_number: issue_number | |
}); | |
if (pull_request.data.draft) { | |
console.log('Pull request is a draft, passing check.'); | |
return; | |
} | |
const comments = await github.rest.issues.listComments({ | |
issue_number: issue_number, | |
owner: owner, | |
repo: repo | |
}); | |
for (const comment of comments.data) { | |
if (comment.body.includes('LGTM')) { | |
console.log('LGTM comment found!'); | |
return; | |
} | |
} | |
throw new Error('No LGTM comment found!'); |