Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): check if user is a maintainer #89

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ on:
- patch
- minor
- major
jrschumacher marked this conversation as resolved.
Show resolved Hide resolved
# TODO remove after test
pull_request:
jrschumacher marked this conversation as resolved.
Show resolved Hide resolved
jrschumacher marked this conversation as resolved.
Show resolved Hide resolved

env:
MAINTAINER_TEAM: opentdf-cli

jobs:
build-targets:
name: build-targets
Expand All @@ -19,6 +25,31 @@ jobs:
GOPRIVATE: github.com/opentdf/platform/*
BIN_NAME: tructl
steps:
- name: Is actor in ${{ env.MAINTAINER_TEAM }}
uses: actions/github-script@v7
with:
script: |
const org = context.repo.owner;
const team_slug = "${{ env.MAINTAINER_TEAM }}";
const username = context.actor;

// API request to check team membership
try {
const resp = await github.rest.teams.getMembershipForUserInOrg({
org,
team_slug,
username,
})
if (response.data.state === 'active') {
console.log(`${username} is a member of the team ${team_slug}.`);
} else {
console.log(`${username} is not an active member of the team ${team_slug}.`);
core.setFailed(`${username} is not an active member of the team ${team_slug}.`);
}
} catch(error) {
console.log(`Error checking membership: ${error}`);
core.setFailed(`Error checking membership: ${error}`);
}
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
Expand Down
Loading