Skip to content

Navigator test documentation #345

Navigator test documentation

Navigator test documentation #345

---
name: Check that issue comments are from MIL members
# yamllint disable-line rule:truthy
on:
issue_comment:
types: [created]
# Disable line length for JS string phrase
# yamllint disable rule:line-length
jobs:
orgcheck:
name: Check that the issue comment author is in the uf-mil org
runs-on: ubuntu-latest
steps:
- name: Comment if user is not part of org
uses: actions/github-script@v3
with:
github-token: ${{secrets.INVESTIGATOR_BOT_TOKEN}}
script: |
const closeableStates = ["none", "read"];
const creator = context.payload.comment.user.login;
const response = await github.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: creator
});
console.log(`${creator} permission: ${response.data.permission}`);
if (closeableStates.includes(response.data.permission) && context.payload.comment.user.type != "Bot") {
github.issues.createComment({
issue_number: ${{ github.event.issue.number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: `@${{ github.event.comment.user.login }}, hola from the [Machine Intelligence Lab at the University of Florida](https://mil.ufl.edu)!
Unfortunately, at this time, we are unable to accept issues and contributions to this repository from users who are not yet part of MIL. We may accept contributions in the future, and some of our other repositories and projects accept contributions. However, because much of our lab is dependent on this repository and because we use several in-house tools to ensure that new additions work properly, we are unable to easily accept the contributions from researchers outside of MIL.
_If you are a member of MIL, please contact a software leader to get access to the @uf-mil organization._`
});
}