Skip to content

Commit eadbc6d

Browse files
authored
Merge branch 'segmentio:main' into feature/updates
2 parents 690e7fe + cf633f8 commit eadbc6d

File tree

104 files changed

+2076
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2076
-317
lines changed

.github/workflows/label-prs.yml

+43
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,46 @@ jobs:
6060
});
6161
await Promise.all(requests);
6262
}
63+
64+
- name: Comment for mapping-kit changes
65+
uses: actions/github-script@v7
66+
env:
67+
labelsToAdd: '${{ steps.compute-labels.outputs.add }}'
68+
labelsToRemove: '${{ steps.compute-labels.outputs.remove }}'
69+
with:
70+
script: |
71+
const { labelsToAdd, labelsToRemove, DRY_RUN } = process.env
72+
const shouldAddComment = labelsToAdd.length > 0 && labelsToAdd.split(",").some(x=>x.includes("mappingkit"))
73+
const shouldRemoveComment = labelsToRemove.length > 0 && labelsToRemove.split(",").some(x=>x.includes("mappingkit"))
74+
// Get the list of comments on the PR
75+
const response = await github.rest.issues.listComments({
76+
issue_number: context.issue.number,
77+
owner: context.repo.owner,
78+
repo: context.repo.repo
79+
})
80+
const mappingKitComment = response.data.find(comment => comment.body.includes('mapping-kit go'))
81+
if(shouldAddComment){
82+
if (mappingKitComment) {
83+
console.log('Already commented on this PR')
84+
return
85+
}
86+
// Add comment to the PR
87+
await github.rest.issues.createComment({
88+
issue_number: context.issue.number,
89+
owner: context.repo.owner,
90+
repo: context.repo.repo,
91+
body: `This PR makes changes to mapping-kit. Please ensure that the changes are reflected in the [mapping-kit go](https://github.com/segmentio/mapping-kit) library as well and link the PR in description.`
92+
})
93+
}
94+
if(shouldRemoveComment) {
95+
if (!mappingKitComment) {
96+
console.log('No mapping-kit comment to remove')
97+
return
98+
}
99+
// Remove comment from the PR
100+
await github.rest.issues.deleteComment({
101+
comment_id: mappingKitComment.id,
102+
owner: context.repo.owner,
103+
repo: context.repo.repo
104+
})
105+
}

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ For more detailed instruction, see the following READMEs:
3131
- [Presets](#presets)
3232
- [perform function](#the-perform-function)
3333
- [Batching Requests](#batching-requests)
34+
- [Parsing MultiStatus Responses](#parsing-multistatus-responses)
3435
- [Action Hooks](#action-hooks)
3536
- [HTTP Requests](#http-requests)
3637
- [Support](#support)
@@ -736,6 +737,12 @@ Keep in mind a few important things about how batching works:
736737
737738
Additionally, you’ll need to coordinate with Segment’s R&D team for the time being. Please reach out to us in your dedicated Slack channel!
738739
740+
## Parsing MultiStatus Responses
741+
742+
When a batch request to a destination returns a 207 MultiStatus response, the `performBatch` method will typically receive an array of responses, indicating the status of each event in the batch. The Actions Framework provides a `MultiStatusResponse` class to help you parse these responses to report a more granular success or failure status for each event.
743+
744+
A detailed example of how to use the `MultiStatusResponse` class can be found in the [MultiStatus Documentation](./docs/multistatus.md).
745+
739746
## Action Hooks
740747
741748
Hooks allow builders to perform requests against a destination at certain points in the lifecycle of a mapping. Values can then be persisted from that request to be used later on in the action's `perform` method.

0 commit comments

Comments
 (0)