Skip to content

Commit

Permalink
Merge branch 'master' into package
Browse files Browse the repository at this point in the history
  • Loading branch information
shridhar-tl committed Jan 9, 2025
2 parents 6966e2f + e03dba4 commit 6484670
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 16 deletions.
85 changes: 72 additions & 13 deletions .github/workflows/issue-responder.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
name: Issue Responder

on:
workflow_dispatch:
inputs:
ticket_number:
description: 'Ticket Number'
required: true
type: integer
ticket_type:
description: 'Ticket Type'
required: true
type: choice
options:
- issues
- discussions
default: issues
avoidUpdate:
description: 'Do not update Resource center'
required: false
type: boolean
default: false
updateDocsOnly:
description: 'Do not add comments to the ticket'
required: false
type: boolean
default: false
issues:
types: [opened]
issue_comment:
types: [created]

discussion:
types: [created]
discussion_comment:
types: [created]

permissions:
issues: write
discussions: write
Expand All @@ -17,7 +45,7 @@ jobs:
steps:
- name: Check if comment is from bot user
run: |
if [[ "${{ github.actor }}" == "github-actions[bot]" ]]; then
if [[ "${{ github.actor }}" == "github-actions[bot]" ]] && [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
echo "Comment was made by the GitHub Actions bot. Exiting without running the script."
exit 0
fi
Expand All @@ -31,32 +59,63 @@ jobs:
run: |
curl -o github.mjs https://bot.jiraassistant.com/actions/github/github.mjs
- name: Identify Action
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "TICKET_TYPE=${{ github.event.inputs.ticket_type }}" >> $GITHUB_ENV
echo "TICKET_NUMBER=${{ github.event.inputs.ticket_number }}" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "discussion_comment" ]] || [[ "${{ github.event_name }}" == "discussion" ]]; then
echo "TICKET_TYPE=discussions" >> $GITHUB_ENV
echo "TICKET_NUMBER=${{ github.event.discussion.number }}" >> $GITHUB_ENV
else
echo "TICKET_TYPE=issues" >> $GITHUB_ENV
echo "TICKET_NUMBER=${{ github.event.issue.number }}" >> $GITHUB_ENV
fi
- name: Retrieve collaborators
id: get-collaborators
run: |
collaborators=$(curl -s -H "Authorization: token ${{ github.token }}" \
"https://api.github.com/repos/${{ github.repository }}/collaborators" | \
jq -r '.[].login')
echo "${collaborators}" > collaborators.txt
if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
collaborators=$(curl -s -H "Authorization: token ${{ github.token }}" \
"https://api.github.com/repos/${{ github.repository }}/collaborators" | \
jq -r '.[].login')
echo "${collaborators}" > collaborators.txt
fi
- name: Check if comment is from collaborator
run: |
COMMENT_USER="${{ github.actor }}"
if grep -q "$COMMENT_USER" collaborators.txt; then
echo "Comment was made by a collaborator."
node github.mjs --ticket "${{ github.event.issue.number }}" \
if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
COMMENT_USER="${{ github.actor }}"
if grep -q "$COMMENT_USER" collaborators.txt; then
echo "Comment was made by a collaborator."
echo "avoidComments=true" >> $GITHUB_ENV
node github.mjs --ticket "$TICKET_NUMBER" \
--ticketType "$TICKET_TYPE" \
--repo "${{ github.repository }}" \
--orgId "${{ vars.RESPONDER_ORG_ID }}" \
--botId "${{ vars.RESPONDER_BOT_ID }}" \
--ghToken "${{ github.token }}" \
--authToken "${{ secrets.RESPONDER_TOKEN }}" \
--updateOnly
exit 0
fi
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]] && [[ "${{ github.event.inputs.updateDocsOnly }}" == "true" ]]; then
echo "avoidComments=true" >> $GITHUB_ENV
node github.mjs --ticket "$TICKET_NUMBER" \
--ticketType "$TICKET_TYPE" \
--repo "${{ github.repository }}" \
--orgId "${{ vars.RESPONDER_ORG_ID }}" \
--botId "${{ vars.RESPONDER_BOT_ID }}" \
--ghToken "${{ github.token }}" \
--authToken "${{ secrets.RESPONDER_TOKEN }}" \
--updateOnly
exit 0
fi
- name: Execute script
- name: Add comment to ticket
if: env.avoidComments != 'true'
run: |
node github.mjs --ticket "${{ github.event.issue.number }}" \
node github.mjs --testMode "${{ github.event.inputs.avoidUpdate }}" --ticket "$TICKET_NUMBER" \
--ticketType "$TICKET_TYPE" \
--repo "${{ github.repository }}" \
--orgId "${{ vars.RESPONDER_ORG_ID }}" \
--botId "${{ vars.RESPONDER_BOT_ID }}" \
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ modules:
onError: RECEIVE_AND_LOG
function:
- key: sprint-started-handler
handler: jcloud-events.onSprintStarted
handler: jcloud-events.onSprintAction
- key: resolver
handler: jcloud.handler
providers:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"react-router-dom": "7.1.1",
"react-scripts": "github:shridhar-tl/react-scripts",
"static-eval": "2.1.1",
"zustand": "5.0.2"
"zustand": "5.0.3"
},
"devDependencies": {
"@craco/craco": "^7.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/views/settings/general/TimeTrackerTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class GlobalTab extends TabControlBase {
await executeService('SELF', 'RELOAD', [], this.$message);
} catch (err) {
this.$message.error('This settings would work only with JA extension v2.41 or above.', 'Unsupported Settings');
console.log("Error reloading settings:", err);
console.error("Error reloading settings:", err);
}
};

Expand Down

0 comments on commit 6484670

Please sign in to comment.