From 522ea5d4cea2087a3db38f251832d54f0b49af33 Mon Sep 17 00:00:00 2001 From: "Mr. Algorithm" <11aravipratapsingh@gmail.com> Date: Mon, 30 Jun 2025 00:26:35 +0530 Subject: [PATCH] updated --- .github/workflows/add-contributor-on-merge.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/add-contributor-on-merge.yml b/.github/workflows/add-contributor-on-merge.yml index 0dcea3c..4a97680 100644 --- a/.github/workflows/add-contributor-on-merge.yml +++ b/.github/workflows/add-contributor-on-merge.yml @@ -4,14 +4,16 @@ on: pull_request: types: - closed + push: + branches: + - main permissions: contents: write - jobs: add-contributor: - if: github.event.pull_request.merged == true + if: github.event_name == 'push' || github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - name: Checkout repo @@ -23,9 +25,15 @@ jobs: node-version: 20 - name: Get PR author username + if: github.event_name == 'pull_request' id: get_author run: echo "username=${{ github.event.pull_request.user.login }}" >> $GITHUB_OUTPUT + - name: Get committer username (for push) + if: github.event_name == 'push' + id: get_author + run: echo "username=${{ github.actor }}" >> $GITHUB_OUTPUT + - name: Add contributor to README env: CONTRIBUTOR_USERNAME: ${{ steps.get_author.outputs.username }} @@ -36,4 +44,4 @@ jobs: uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "chore: add ${{ steps.get_author.outputs.username }} to Contributors in README" - branch: ${{ github.event.pull_request.base.ref }} + branch: main