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

ci: fix HTTP PUT request to the GitHub REST API #1664

29 changes: 16 additions & 13 deletions .github/workflows/maintainer_management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ on:
types: [closed]
paths:
- 'MAINTAINERS.yaml'

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN_ORG_ADMIN: ${{ secrets.GH_TOKEN_ORG_ADMIN }}

jobs:
detect_maintainer_changes:
Expand Down Expand Up @@ -75,11 +76,11 @@ jobs:

- name: Debug newMaintainers output
run: |
echo "newMaintainers = $newMaintainers"
echo "newMaintainers = ${{ steps.compare-files.outputs.newMaintainers }}"

- name: Debug removedMaintainers output
run: |
echo "removedMaintainers = $removedMaintainers"
echo "removedMaintainers = ${{ steps.compare-files.outputs.removedMaintainers }}"

outputs:
newMaintainers: ${{ steps.compare-files.outputs.newMaintainers }}
Expand All @@ -94,7 +95,7 @@ jobs:
- name: Invite new maintainers to the organization
uses: actions/github-script@v6
with:
github-token: ${{ env.GH_TOKEN }}
github-token: ${{ env.GH_TOKEN_ORG_ADMIN }}
script: |
const newMaintainers = '${{ needs.detect_maintainer_changes.outputs.newMaintainers }}'.split(',');
for (const maintainer of newMaintainers) {
Expand All @@ -111,7 +112,7 @@ jobs:
- name: Add new maintainers to the team
uses: actions/github-script@v6
with:
github-token: ${{ env.GH_TOKEN }}
github-token: ${{ env.GH_TOKEN_ORG_ADMIN }}
script: |
const newMaintainers = '${{ needs.detect_maintainer_changes.outputs.newMaintainers }}'.split(',');
for (const maintainer of newMaintainers) {
Expand All @@ -137,7 +138,7 @@ jobs:
- name: Display welcome message for new maintainers
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
github-token: ${{ env.GH_TOKEN_ORG_ADMIN }}
script: |
const newMaintainers = "${{ needs.add_maintainer.outputs.newMaintainers }}".split(",");
console.log(`New maintainers: ${newMaintainers}`);
Expand All @@ -161,12 +162,13 @@ jobs:
- name: Remove maintainers from the organization
uses: actions/github-script@v6
with:
github-token: ${{ env.GH_TOKEN }}
github-token: ${{ env.GH_TOKEN_ORG_ADMIN }}
script: |
const removedMaintainers = '${{ needs.detect_maintainer_changes.outputs.removedMaintainers }}'.split(',');
for (const maintainer of removedMaintainers) {
try {
await github.request('DELETE /orgs/asyncapi/memberships/{username}', {
await github.request('DELETE /orgs/{org}/memberships/{username}', {
org: 'asyncapi',
username: maintainer
});
core.info(`Successfully removed ${maintainer} from the organization.`);
Expand All @@ -187,7 +189,7 @@ jobs:
- name: Display goodbye message to removed maintainers
uses: actions/github-script@v6
with:
github-token: ${{ env.GH_TOKEN }}
github-token: ${{ env.GH_TOKEN_ORG_ADMIN }}
script: |
const removedMaintainers = "${{ needs.remove_maintainer.outputs.removedMaintainers }}".split(",");
const removedTscMembers = "${{ needs.remove_maintainer.outputs.removedTscMembers }}".split(",");
Expand Down Expand Up @@ -218,7 +220,7 @@ jobs:
- name: Add TSC members to Emeritus.yaml and print
uses: actions/github-script@v6
with:
github-token: ${{ env.GH_TOKEN }}
github-token: ${{ env.GH_TOKEN_ORG_ADMIN }}
script: |
const fs = require('fs');
const path = './Emeritus.yaml';
Expand Down Expand Up @@ -249,8 +251,9 @@ jobs:
- name: Commit and push
run: |
git add .
git commit -m "Update Emeritus.yaml"
git push https://${{ secrets.GH_TOKEN}}@github.com/asyncapi/community update-emeritus-${{ github.run_id }}
git commit -m "chore: update Emeritus.yaml"
git remote set-url origin https://x-access-token:${{ env.GH_TOKEN_ORG_ADMIN }}@github.com/asyncapi/community.git
git push origin update-emeritus-${{ github.run_id }}

- name: Create PR
run: |
Expand All @@ -267,4 +270,4 @@ jobs:
SLACK_WEBHOOK: ${{secrets.SLACK_CI_FAIL_NOTIFY}}
SLACK_TITLE: 🚨 Maintainer Management Workflow failed 🚨
SLACK_MESSAGE: Failed to post a message to new Maintainer
MSG_MINIMAL: true
MSG_MINIMAL: true
10 changes: 5 additions & 5 deletions Emeritus.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# This file lists individuals who were previously TSC members and Ambassadors but are no longer active.

emeritus_ambassadors:
- jessemenning
- meteatamel
- raphaeldelio

emeritus_tsc:
- jotamusik
- LouisXhaferi
Expand All @@ -18,8 +23,3 @@ emeritus_tsc:
- emilianozublena
- NektariosFifes
- M3lkior

emeritus_ambassadors:
- jessemenning
- meteatamel
- raphaeldelio