-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into hide-all-shorcut-2
- Loading branch information
Showing
155 changed files
with
2,913 additions
and
1,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,7 +99,7 @@ jobs: | |
cat "${DOCKERFILE_PATH}" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.6.1 | ||
uses: docker/setup-buildx-action@v3.7.1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
@@ -108,7 +108,7 @@ jobs: | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Push Docker image | ||
uses: docker/build-push-action@v6.8.0 | ||
uses: docker/build-push-action@v6.9.0 | ||
id: docker_build_and_push | ||
with: | ||
context: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ jobs: | |
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.6.1 | ||
uses: docker/setup-buildx-action@v3.7.1 | ||
|
||
- name: Login to RedHat Registry | ||
uses: docker/[email protected] | ||
|
@@ -167,7 +167,7 @@ jobs: | |
core.setOutput("ubi-tags", ubiTags.join(',')); | ||
- name: Build and push ubi | ||
uses: docker/build-push-action@v6.8.0 | ||
uses: docker/build-push-action@v6.9.0 | ||
id: docker_build_and_push_ubi | ||
with: | ||
context: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ jobs: | |
echo "build_version=$version" >> $GITHUB_OUTPUT | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.6.1 | ||
uses: docker/setup-buildx-action@v3.7.1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
@@ -131,7 +131,7 @@ jobs: | |
fi | ||
- name: Push Docker image | ||
uses: docker/build-push-action@v6.8.0 | ||
uses: docker/build-push-action@v6.9.0 | ||
id: docker_build_and_push | ||
with: | ||
context: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,7 +170,7 @@ jobs: | |
fi | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.6.1 | ||
uses: docker/setup-buildx-action@v3.7.1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
@@ -208,7 +208,7 @@ jobs: | |
EOF | ||
- name: Build and Push Release Ubuntu Docker image | ||
uses: docker/build-push-action@v6.8.0 | ||
uses: docker/build-push-action@v6.9.0 | ||
id: docker_build | ||
with: | ||
context: ${{ steps.release_dockerfile.outputs.release_dir }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "ZenDesk: Push an issue comment to zendesk ticket" | ||
|
||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
|
||
jobs: | ||
issue_commented: | ||
name: Issue comment | ||
if: ${{ !github.event.issue.pull_request && github.event.issue.user.login != 'heidi-humansignal' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- env: | ||
ZENDESK_HOST: ${{ vars.ZENDESK_HOST }} | ||
ZENDESK_USER: ${{ vars.ZENDESK_USER }} | ||
ZENDESK_TOKEN: ${{ secrets.ZENDESK_TOKEN }} | ||
ISSUE_URL: ${{ github.event.issue.html_url }} | ||
ISSUE_COMMENT_BODY: ${{ github.event.comment.body }} | ||
ISSUE_USER: ${{ github.event.comment.user.login }} | ||
WORKFLOW_RUN_LINK: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
run: | | ||
echo "Looking up ticket by issue: ${ISSUE_URL}" | ||
tickets=$(curl "https://${ZENDESK_HOST}/api/v2/search.json?query=external_id:${ISSUE_URL}" \ | ||
--user "${ZENDESK_USER}/token:${ZENDESK_TOKEN}" \ | ||
-H "Content-Type: application/json") | ||
ticket_id=$(echo $tickets | jq '.results[0].id') | ||
echo "Found Zendesk ticket ${ticket_id}" | ||
echo "Looking up user by issuer: ${ISSUE_USER}" | ||
users=$(curl "https://labelstudio.zendesk.com/api/v2/users/[email protected]" \ | ||
--user "${ZENDESK_USER}/token:${ZENDESK_TOKEN}" \ | ||
--header "Content-Type: application/json") | ||
user_id=$(echo $users | jq '.users[0].id') | ||
if [[ "$user_id" == "null" ]]; then | ||
echo "Fall back to generic github user" | ||
user_id="388861316959" | ||
else | ||
echo "Found user ${user_id}" | ||
fi | ||
body=$(jq -n --arg body "$ISSUE_COMMENT_BODY" '{body: $body}' | jq .body) | ||
echo "$body" | ||
curl "https://${ZENDESK_HOST}/api/v2/tickets/${ticket_id}.json" \ | ||
--request PUT \ | ||
--user "${ZENDESK_USER}/token:${ZENDESK_TOKEN}" \ | ||
--header "Content-Type: application/json" \ | ||
--data-binary @- <<DATA | ||
{ | ||
"ticket": { | ||
"comment": { | ||
"body": "[GITHUB_ISSUE_COMMENT]\n\n${body:1:-1}\n\nGITHUB ISSUE URL: ${ISSUE_URL}\nWORKFLOW RUN: ${WORKFLOW_RUN_LINK}", | ||
"author_id": $user_id | ||
} | ||
} | ||
} | ||
DATA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: "ZenDesk: Create a zendesk ticket out of an issue" | ||
|
||
on: | ||
issues: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
issue_created: | ||
name: Issue created | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- env: | ||
ZENDESK_HOST: ${{ vars.ZENDESK_HOST }} | ||
ZENDESK_USER: ${{ vars.ZENDESK_USER }} | ||
ZENDESK_TOKEN: ${{ secrets.ZENDESK_TOKEN }} | ||
ISSUE_TITLE: ${{ github.event.issue.title }} | ||
ISSUE_BODY: ${{ github.event.issue.body }} | ||
ISSUE_USER: ${{ github.event.issue.user.login }} | ||
ISSUE_URL: ${{ github.event.issue.html_url }} | ||
WORKFLOW_RUN_LINK: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
run: | | ||
body=$(jq -n --arg body "$ISSUE_BODY" '{body: $body}' | jq .body) | ||
echo "$body" | ||
curl https://${ZENDESK_HOST}/api/v2/tickets \ | ||
--request POST \ | ||
--user "${ZENDESK_USER}/token:${ZENDESK_TOKEN}" \ | ||
--header "Content-Type: application/json" \ | ||
--data-binary @- <<DATA | ||
{ | ||
"ticket": { | ||
"subject": "Github_Issue: $ISSUE_TITLE", | ||
"comment": { | ||
"body": "[GITHUB_ISSUE_DESCRIPTION]\n\n${body:1:-1}\n\nGITHUB ISSUE URL: ${ISSUE_URL}\nWORKFLOW RUN: ${WORKFLOW_RUN_LINK}" | ||
}, | ||
"tags": ["gh-issue"], | ||
"external_id": "$ISSUE_URL", | ||
"requester": { | ||
"locale_id": 1, | ||
"name": "$ISSUE_USER from Github", | ||
"email": "[email protected]" | ||
} | ||
} | ||
} | ||
DATA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: "ZenDesk: Comment GitHub Issue on Zendesk Ticket Comment" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
client_payload: | ||
description: "Payload from Zendesk" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
process_comment_and_labels: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- uses: actions/github-script@v5 | ||
env: | ||
PAYLOAD: ${{ inputs.client_payload }} | ||
with: | ||
github-token: ${{ secrets.GIT_PAT_HEIDI }} | ||
script: | | ||
const payload = JSON.parse(process.env.PAYLOAD); | ||
console.log("Parsed payload: ", JSON.stringify(payload, null, 2)); | ||
// Extract issue details from the Zendesk external_id | ||
const parts = payload.ticket.external_id.split("/"); | ||
const issue_number = parts[parts.length - 1]; | ||
const issue_repo = parts[parts.length - 3]; | ||
const issue_owner = parts[parts.length - 4]; | ||
// Extract comment details | ||
const comment_author = payload.comment.author || "HumanSignal Support"; | ||
const comment_body = payload.comment.body; | ||
const formatted_comment_body = `${comment_body}\n\n*Comment by ${comment_author}*`; | ||
// Add a comment to the GitHub issue | ||
await github.rest.issues.createComment({ | ||
owner: issue_owner, | ||
repo: issue_repo, | ||
issue_number: issue_number, | ||
body: formatted_comment_body | ||
}); | ||
// Extract labels from the custom_field | ||
let new_labels = []; | ||
if (payload.ticket.custom_field) { | ||
new_labels = payload.ticket.custom_field.split(" ").map(label => label.trim()); | ||
} | ||
// Get the current labels on the GitHub issue | ||
const { data: current_labels } = await github.rest.issues.listLabelsOnIssue({ | ||
owner: issue_owner, | ||
repo: issue_repo, | ||
issue_number: issue_number | ||
}); | ||
const current_label_names = current_labels.map(label => label.name); | ||
// Labels to be added | ||
const labels_to_add = new_labels.filter(label => !current_label_names.includes(label)); | ||
// Labels to be removed | ||
const labels_to_remove = current_label_names.filter(label => !new_labels.includes(label)); | ||
// Remove labels that are not in the new labels list | ||
for (const label of labels_to_remove) { | ||
await github.rest.issues.removeLabel({ | ||
owner: issue_owner, | ||
repo: issue_repo, | ||
issue_number: issue_number, | ||
name: label | ||
}); | ||
} | ||
// Add the new labels | ||
if (labels_to_add.length > 0) { | ||
await github.rest.issues.addLabels({ | ||
owner: issue_owner, | ||
repo: issue_repo, | ||
issue_number: issue_number, | ||
labels: labels_to_add | ||
}); | ||
} | ||
console.log("Comment and labels successfully added to GitHub issue."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: "ZenDesk: Close GitHub Issue on Zendesk Ticket Solved" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
client_payload: | ||
description: "Payload from Zendesk" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
close_issue: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- uses: actions/github-script@v5 | ||
env: | ||
PAYLOAD: ${{ inputs.client_payload }} | ||
with: | ||
github-token: ${{ secrets.GIT_PAT_HEIDI }} | ||
script: | | ||
const payload = JSON.parse(process.env.PAYLOAD); | ||
console.log("Parsed payload: ", JSON.stringify(payload, null, 2)); | ||
// Extract issue details from the Zendesk external_id | ||
const parts = payload.ticket.external_id.split("/"); | ||
const issue_number = parts[parts.length - 1]; | ||
const issue_repo = parts[parts.length - 3]; | ||
const issue_owner = parts[parts.length - 4]; | ||
// Close the GitHub issue | ||
await github.rest.issues.update({ | ||
owner: issue_owner, | ||
repo: issue_repo, | ||
issue_number: issue_number, | ||
state: "closed" | ||
}); | ||
console.log(`GitHub issue #${issue_number} closed successfully.`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.