From 6ce27353885fd4ad8342662af78f6c3407f862b3 Mon Sep 17 00:00:00 2001 From: Jesse McGinnis Date: Thu, 2 May 2024 15:22:05 -0400 Subject: [PATCH] Adjust /generate_dist command --- .github/workflows/generate_dist.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate_dist.yml b/.github/workflows/generate_dist.yml index a482b51b..2feb1e1e 100644 --- a/.github/workflows/generate_dist.yml +++ b/.github/workflows/generate_dist.yml @@ -17,8 +17,21 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.issue.pull_request && github.event.comment.body == '/generate_dist' }} steps: + - name: Fetch PR Details + id: get-pr + run: | + # GitHub API Token and PR URL + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + PR_URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}" + + # Fetch the PR details + PR_RESPONSE=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X GET "$PR_URL") + echo "::set-output name=head_ref::$(echo "$PR_RESPONSE" | jq -r .head.ref)" + - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ steps.get-pr.outputs.head_ref }} - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -38,8 +51,8 @@ jobs: - name: Commit distribution files run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "GitHub Action" + git config --local user.email "action@github.com" git add dist - git commit -m "🤖 Update distribution files" + git commit -m "🤖 Update distribution files" || exit 0 # Exit gracefully if no changes git push