Skip to content

Write tests for sub9 submodule of mil_usb_to_can #167

Write tests for sub9 submodule of mil_usb_to_can

Write tests for sub9 submodule of mil_usb_to_can #167

---
name: Check that new issues are opened by organization members
# yamllint disable-line rule:truthy
on:
issues:
types: [opened]
# yamllint disable rule:line-length
jobs:
orgcheck:
name: Check that the issue 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.issue.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.issue.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._`
});
github.issues.update({
issue_number: ${{ github.event.issue.number }},
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed',
state_reason: 'not_planned'
});
}