Skip to content

Update set-pr-labels.js #22

Update set-pr-labels.js

Update set-pr-labels.js #22

Workflow file for this run

name: Pull Request Verification
on:
pull_request_target:
types: [opened]
branches:
- '*'
jobs:
Check-Team-Membership:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.HACKFORLA_ADMIN_TOKEN }}
script: |
const prAuthor = context.payload.sender.login;
const prNumber = context.payload.number;
try {
await github.rest.teams.getMembershipForUserInOrg({
org: 'hackforla',
team_slug: 'website-write',
username: prAuthor
});
console.log('Successfully verified!')
} catch (verificationError) {
if (verificationError.status==404) {
await github.rest.issues.update({
owner : 'hackforla',
repo : 'website',
issue_number : prNumber,
state : 'closed'
});
await github.rest.issues.createComment({
owner : 'hackforla',
repo : 'website',
issue_number : prNumber,
body : 'You must be a member of the HFLA website team in order to create pull requests. Please see our page on how to join us as a member at HFLA: https://www.hackforla.org/getting-started. If you have been though onboarding, and feel you have received this message in error, please message us in the #hfla-site team slack channel with the link to this PR.'
});
}
}