Webhook payload. Is accessible for scripts? #2681
-
If you are looking for help, please confirm the following...
Which mobile framework are you using?Flutter (Dart) Steps to reproduceI am trying to utilize the Pull title from the when:
condition: (not event.pull_request.draft) or (event.pull_request.labels[0].name == "run-codemagic") However when I try to access the same payload in one of the scripts its not working. For e.g. as shown below. - name: Set up release notes
script: |
echo $(event.pull_request.title) | jq '.' > $FCI_BUILD_DIR/release_notes.json
cat $FCI_BUILD_DIR/release_notes.json Is there a specific way to access this webhoook payload within the scripts. Expected resultsthe PR title is accessible in the command line. Actual resultsIts not clear how to access it in the scripts section. Build id (optional)No response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
hey @bahag-chandrana in Codemagic, accessing the event payload directly within scripts isn't straightforward because the event object isn't available for direct execution. The when condition can evaluate event payloads because it’s processed in a different phase of the workflow execution. However, you can achieve something similar by creating a script that generates release notes for a pull request (PR) using the GitHub CLI (gh) to fetch the PR title.
|
Beta Was this translation helpful? Give feedback.
-
I'm tentatively closing the discussion since we haven't heard back from you. You can open the discussion again by replying to this message or opening a new discussion. |
Beta Was this translation helpful? Give feedback.
hey @bahag-chandrana in Codemagic, accessing the event payload directly within scripts isn't straightforward because the event object isn't available for direct execution. The when condition can evaluate event payloads because it’s processed in a different phase of the workflow execution. However, you can achieve something similar by creating a script that generates release notes for a pull request (PR) using the GitHub CLI (gh) to fetch the PR title.
First you need to create a personal access token as described in the GitHub documentation.
Next, add this token as an environment variable in Codemagic and reference it in your workflow.