Skip to content

Commit

Permalink
Adjust /generate_dist command
Browse files Browse the repository at this point in the history
  • Loading branch information
elsom25 committed May 2, 2024
1 parent 3266f38 commit 6ce2735
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/generate_dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 6ce2735

Please sign in to comment.