From c12287b5e291f3fb6c949a2344034e9736fc39cf Mon Sep 17 00:00:00 2001 From: 14Richa Date: Thu, 10 Aug 2023 16:14:12 +0530 Subject: [PATCH] fix in update maintainer workflow --- .github/workflows/update-maintainers.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/update-maintainers.yml b/.github/workflows/update-maintainers.yml index 0324dfc..c4cd1ba 100644 --- a/.github/workflows/update-maintainers.yml +++ b/.github/workflows/update-maintainers.yml @@ -10,7 +10,8 @@ on: jobs: update-maintainers: runs-on: ubuntu-latest - + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} steps: - name: Checkout main branch uses: actions/checkout@v3 @@ -31,7 +32,7 @@ jobs: uses: actions/checkout@v3 with: repository: asyncapi/community - token: ${{ secrets.GH_TOKEN}} + token: ${{ env.GITHUB_TOKEN }} path: community - name: Setup Node.js @@ -45,7 +46,7 @@ jobs: - name: Compare CODEOWNERS id: compare-codeowners env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} + GH_TOKEN: ${{ env.GITHUB_TOKEN }} uses: actions/github-script@v6 with: script: | @@ -94,16 +95,19 @@ jobs: continue; // Skip the iteration for bot accounts } - const maintainer = maintainers.find(maintainer => maintainer.github === username); + const maintainer = maintainers.find(maintainer => maintainer.github === username.toLowerCase()); if (!maintainer) { const { data } = await github.rest.users.getByUsername({ username }); const twitterUsername = data.twitter_username; - maintainers.push({ + const newMaintainer = { github: username, - twitter: twitterUsername, isTscMember: false, repos: [repoName] - }); + }; + if (twitterUsername) { + newMaintainer.twitter = twitterUsername; + } + maintainers.push(newMaintainer); core.info('Added maintainer:', username); } else { // If the maintainer already exists, check if the current repo is in their list @@ -151,9 +155,11 @@ jobs: - name: Commit and push working-directory: ./community run: | + git config --global user.email "info@asyncapi.io" + git config --global user.name "asyncapi-bot" git add . git commit -m "Update MAINTAINERS.yaml" - git push https://${{ secrets.GH_TOKEN}}@github.com/asyncapi/community update-maintainers-${{ github.run_id }} + git push https://${{ env.GITHUB_TOKEN }}@github.com/asyncapi/community - name: Create PR working-directory: ./community