-
Notifications
You must be signed in to change notification settings - Fork 3.5k
35 lines (30 loc) · 1.05 KB
/
zendesk_task_solve.yml
File metadata and controls
35 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: "ZenDesk: Close GitHub Issue on Zendesk Ticket Solved"
on:
workflow_dispatch:
inputs:
external_id:
description: "GitHub issue url"
required: true
type: string
jobs:
close_issue:
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v3.0.0
- uses: actions/github-script@v8
with:
github-token: ${{ secrets.GIT_PAT_HEIDI }}
script: |
// Extract issue details from the Zendesk external_id
const parts = context.payload.inputs.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
const { data: issue } await github.rest.issues.update({
owner: issue_owner,
repo: issue_repo,
issue_number: issue_number,
state: "closed"
});
core.info(`GitHub issue ${issue.html_url} closed successfully.`);