Skip to content

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

chore(ci): check if user is a maintainer

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

Workflow file for this run

name: 'Release'
on:
workflow_dispatch:
inputs:
versionBumpType:
description: 'Version Bump Type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
# TODO remove after test
pull_request:
env:
MAINTAINER_TEAM: cli
jobs:
build-targets:
name: build-targets
runs-on: ubuntu-22.04
env:
GOPRIVATE: github.com/opentdf/platform/*
BIN_NAME: otdfctl
steps:
- name: Is actor in ${{ env.MAINTAINER_TEAM }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('context', context);
const org = context.repo.owner;
console.log('org', org);
const team_slug = "${{ env.MAINTAINER_TEAM }}";
console.log('team_slug', team_slug);
const username = context.actor;
console.log('username', username);
// API request to check team membership
try {
const { data } = 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}`);
// }
console.log(data);
} catch (error) {
console.error(error);
}
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version-file: './go.mod'
# cache: false
# - name: Get next version
# uses: reecetech/[email protected]
# id: version
# with:
# release_branch: main
# scheme: semver
# increment: ${{ github.event.inputs.versionBumpType }}
# pep440: false
# - name: print-version
# run: echo Incrementing Version ${{ steps.version.outputs.current-v-version }} -> ${{ steps.version.outputs.v-version }}
# - name: make-targets
# env:
# SEM_VER: ${{ steps.version.outputs.v-version }}
# run: make build
# - name: smoke-test
# run: go test ./... -short -race -cover
# - name: Compress the builds and generate checksums
# env:
# SEM_VER: ${{ steps.version.outputs.v-version }}
# run: make zip-builds
# - name: Release
# uses: softprops/action-gh-release@v2
# with:
# files: './output/**/*'
# body: 'This is a test release, and will be removed'
# tag_name: ${{ steps.version.outputs.v-version }}
# repository: opentdf/otdfctl
# generate_release_notes: true