From 3638645b8a079e0c08d66486cd30f3f1ee52049f Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Tue, 7 May 2024 13:15:15 -0400 Subject: [PATCH] get closed by user --- ...update-be-new-migration-latest-timestamp.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/update-be-new-migration-latest-timestamp.yml b/.github/workflows/update-be-new-migration-latest-timestamp.yml index 160828473..f35c33142 100644 --- a/.github/workflows/update-be-new-migration-latest-timestamp.yml +++ b/.github/workflows/update-be-new-migration-latest-timestamp.yml @@ -38,6 +38,23 @@ jobs: rm added_files.txt git commit -m "chore: renamed new migration files to latest timestamp (gh-action)" + - name: Get the username of the person who closed the PR + run: | + PR_NUMBER=${{ github.event.pull_request.number }} + REPO_NAME=${{ github.repository }} + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + + # Use GitHub API to fetch PR data + PR_DATA=$(curl \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/$REPO_NAME/pulls/$PR_NUMBER) + + # Extract the username of the person who closed the PR + CLOSED_BY=$(echo $PR_DATA | jq -r .closed_by.login) + + echo "Pull Request #$PR_NUMBER was closed by $CLOSED_BY" + - name: Create Pull Request if: env.SKIP_RENAME != 'true' uses: peter-evans/create-pull-request@v6