Skip to content

Commit

Permalink
ci: fix HTTP PUT request to the GitHub REST API (#1664)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeworxet authored Feb 11, 2025
1 parent 1f80fcb commit 65212dd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
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

0 comments on commit 65212dd

Please sign in to comment.