-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix workflow - wrong check team members
- Loading branch information
Showing
2 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Make release candidate | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
org: | ||
required: true | ||
type: string | ||
repo: | ||
required: true | ||
type: string | ||
team: | ||
required: true | ||
type: string | ||
user: | ||
required: true | ||
type: string | ||
issue: | ||
required: true | ||
type: string | ||
secrets: | ||
git_token: | ||
required: true | ||
|
||
jobs: | ||
make_rc: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main # Checkout the main branch | ||
|
||
- name: Add comment to issue | ||
env: | ||
GH_TOKEN: ${{ secrets.git_token }} | ||
org: ${{ inputs.org }} | ||
repo: ${{ inputs.repo }} | ||
issue: ${{ inputs.issue }} | ||
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
run: | | ||
curl -s https://raw.githubusercontent.com/untillpro/ci-action/master/scripts/add-issue-commit.sh | bash | ||
- name: Check Issue | ||
run: | | ||
echo "org: ${{ inputs.org }}" | ||
echo "team: ${{ inputs.team }}" | ||
echo "user: ${{ inputs.user }}" | ||
echo "title: ${{ inputs.issue-title }}" | ||
ORG_NAME=${{ inputs.org }} | ||
TEAM_NAME=${{ inputs.team }} | ||
USER_NAME=${{ inputs.user }} | ||
echo "org1: $ORG_NAME" | ||
echo "team1: $TEAM_NAME" | ||
echo "user1: $USER_NAME" | ||
# Check organization membership | ||
ORG_MEMBERSHIP=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer ${{ secrets.git_token }}" "https://api.github.com/orgs/$ORG_NAME/members/$USER_NAME") | ||
|
||
if [[ $ORG_MEMBERSHIP -ne 404 ]]; then | ||
echo "The user $USER_NAME is a member of the organization $ORG_NAME." | ||
else | ||
echo "The user $USER_NAME is not a member of the organization $ORG_NAME." | ||
exit 1 | ||
fi | ||
|
||
# Check team membership | ||
TEAM_MEMBERSHIP=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer ${{ secrets.git_token }}" "https://api.github.com/orgs/$ORG_NAME/teams/$TEAM_NAME/memberships/$USER_NAME") | ||
echo "$TEAM_MEMBERSHIP" | ||
if [[ $TEAM_MEMBERSHIP -eq 200 ]]; then | ||
echo "The user $USER_NAME is a member of the team $TEAM_NAME within the organization $ORG_NAME." | ||
else | ||
echo "The user $USER_NAME is not a member of the team $TEAM_NAME within the organization $ORG_NAME." | ||
exit 1 | ||
fi | ||
|
||
# Make RC for the repo here: | ||
|
||
- name: Re-create release branch | ||
env: | ||
GH_TOKEN: ${{ secrets.git_token }} | ||
org: ${{ inputs.org }} | ||
repo: ${{ inputs.repo }} | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "upload-robot" | ||
git config --global url.https://${{ secrets.git_token }}@github.com/.insteadOf https://github.com/ | ||
curl -s https://raw.githubusercontent.com/untillpro/ci-action/master/scripts/rc.sh | bash | ||
- name: Close issue | ||
env: | ||
GH_TOKEN: ${{ secrets.git_token }} | ||
org: ${{ inputs.org }} | ||
repo: ${{ inputs.repo }} | ||
issue: ${{ inputs.issue }} | ||
run: curl -s https://raw.githubusercontent.com/untillpro/ci-action/master/scripts/close-issue.sh | bash |