Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Jul 27, 2023
1 parent 804c2de commit 00a8e1a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/ci-renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,25 @@ jobs:
id: commit
run: |
echo "::set-output name=commit_hash::$(git rev-parse HEAD)"
- name: debug
run: |
echo github.event.pull_request
- name: Dispatch pull_request event
run: |
# Get the original pull_request payload using jq
ORIGINAL_PAYLOAD=$(cat $GITHUB_EVENT_PATH | jq .)
# Update the head.sha field with the new commit hash
# Prepare the custom payload for the pull_request event
NEW_COMMIT_HASH=$(echo "${{ steps.commit.outputs.commit_hash }}")
UPDATED_PAYLOAD=$(echo "$ORIGINAL_PAYLOAD" | jq ".pull_request.head.sha = \"$NEW_COMMIT_HASH\"")
PAYLOAD="{\"commit_hash\": \"$NEW_COMMIT_HASH\"}"
# Dispatch the pull_request event with the updated payload
# Dispatch the pull_request event with the custom payload
curl -X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-d "$UPDATED_PAYLOAD" \
-d "$PAYLOAD" \
"https://api.github.com/repos/${{ github.repository }}/dispatches"
In this updated workflow, we removed the unnecessary fields from the payload and included only the "commit_hash" field in the custom payload. When you dispatch the pull_request event using this payload, it will include the new commit hash in the custom data. The receiving workflow listening for the "pull_request" event will need to extract and use this "commit_hash" information to process the event based on the new commit.


# - name: Dispatch custom event FooBar
# run: |
# # Customize the payload as needed
Expand Down

0 comments on commit 00a8e1a

Please sign in to comment.