Skip to content

Commit

Permalink
Update cmd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mordamax committed Aug 21, 2024
1 parent 298e245 commit c853811
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/cmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,36 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Generate token
id: generate_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.CMD_BOT_APP_ID }}
private_key: ${{ secrets.CMD_BOT_APP_KEY }}

- name: Check if user is a member of the organization
id: is-member
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ steps.generate_token.outputs.token }}
script: |
const membership = await github.rest.orgs.checkMembershipForUser({
org: context.repo.owner,
username: context.actor
})
return membership.data.state === 'active'
try {
const org = 'paritytech';
const username = context.actor;
const membership = await github.rest.orgs.checkMembershipForUser({
org: org,
username: username
});
console.log(membership)
} catch (error) {
console.log(error)
return { 'is-member': false }
}
return {
'is-member': membership.status === 204
}
reject-non-members:
needs: is-org-member
Expand Down

0 comments on commit c853811

Please sign in to comment.