fix-ect for mapping values are not allowed in this context
Some checks failed
Close Stale Issues / stale (push) Failing after 2s

This commit is contained in:
2026-02-13 15:55:41 +00:00
parent b49cb010b2
commit 98d2cfe881

View File

@@ -14,12 +14,12 @@ jobs:
ISSUE_NUMBER: ${{ gitea.event.issue.number }} ISSUE_NUMBER: ${{ gitea.event.issue.number }}
ISSUE_AUTHOR: ${{ gitea.event.issue.user.login }} ISSUE_AUTHOR: ${{ gitea.event.issue.user.login }}
ISSUE_TITLE: ${{ gitea.event.issue.title }} ISSUE_TITLE: ${{ gitea.event.issue.title }}
ISSUE_BODY: ${{ gitea.event.issue.body }}
steps: steps:
- name: Welcome new contributors - name: Welcome new contributors
if: gitea.event.action == 'opened' if: gitea.event.action == 'opened'
run: | run: |
# Check if this is the user's first issue
AUTHOR_ISSUES=$(curl -s -H "Authorization: token $API_TOKEN" "$API_BASE_URL/repos/$REPO/issues?state=all&created_by=$ISSUE_AUTHOR" | jq '. | length') AUTHOR_ISSUES=$(curl -s -H "Authorization: token $API_TOKEN" "$API_BASE_URL/repos/$REPO/issues?state=all&created_by=$ISSUE_AUTHOR" | jq '. | length')
if [ "$AUTHOR_ISSUES" -eq 1 ]; then if [ "$AUTHOR_ISSUES" -eq 1 ]; then
@@ -29,47 +29,54 @@ jobs:
fi fi
- name: Auto-label bug reports - name: Auto-label bug reports
if: contains(gitea.event.issue.title, '[BUG]') || contains(gitea.event.issue.labels.*.name, 'bug')
run: | run: |
LABELS='{"labels": ["bug", "status: investigating"]}' if echo "$ISSUE_TITLE" | grep -q "\[BUG\]"; then
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABELS" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels" LABELS='{"labels": ["bug", "status: investigating"]}'
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABELS" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels"
fi
- name: Auto-label feature requests - name: Auto-label feature requests
if: contains(gitea.event.issue.title, '[FEATURE]') || contains(gitea.event.issue.labels.*.name, 'feature')
run: | run: |
LABELS='{"labels": ["feature", "status: under-review"]}' if echo "$ISSUE_TITLE" | grep -q "\[FEATURE\]"; then
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABELS" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels" LABELS='{"labels": ["feature", "status: under-review"]}'
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABELS" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels"
fi
- name: Auto-label support requests - name: Auto-label support requests
if: contains(gitea.event.issue.title, '[SUPPORT]') || contains(gitea.event.issue.labels.*.name, 'question')
run: | run: |
LABELS='{"labels": ["question", "status: needs-response"]}' if echo "$ISSUE_TITLE" | grep -q "\[SUPPORT\]"; then
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABELS" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels" LABELS='{"labels": ["question", "status: needs-response"]}'
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABELS" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels"
fi
- name: Auto-label documentation issues - name: Auto-label documentation issues
if: contains(gitea.event.issue.title, '[DOCS]') || contains(gitea.event.issue.labels.*.name, 'documentation')
run: | run: |
LABELS='{"labels": ["documentation", "status: under-review"]}' if echo "$ISSUE_TITLE" | grep -q "\[DOCS\]"; then
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABELS" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels" LABELS='{"labels": ["documentation", "status: under-review"]}'
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABELS" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels"
fi
- name: Assign to team for critical bugs - name: Assign to team for critical bugs
if: contains(gitea.event.issue.labels.*.name, 'priority: critical')
run: | run: |
ASSIGNEES='{"assignees": ["psmattas"]}' LABELS=$(curl -s -H "Authorization: token $API_TOKEN" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels")
curl -s -f -X PATCH -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$ASSIGNEES" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER" HAS_CRITICAL=$(echo "$LABELS" | jq -r '.[] | select(.name == "priority: critical") | .name')
URGENT_MSG="🚨 **Critical Issue Detected**\n\nThis issue has been marked as critical and assigned to @psmattas for immediate attention.\n\nExpected response time: **4 hours**" if [ -n "$HAS_CRITICAL" ]; then
COMMENT_JSON=$(jq -n --arg body "$URGENT_MSG" '{"body": $body}') ASSIGNEES='{"assignees": ["psmattas"]}'
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$COMMENT_JSON" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/comments" curl -s -f -X PATCH -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$ASSIGNEES" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER"
URGENT_MSG="🚨 **Critical Issue Detected**\n\nThis issue has been marked as critical and assigned to @psmattas for immediate attention.\n\nExpected response time: **4 hours**"
COMMENT_JSON=$(jq -n --arg body "$URGENT_MSG" '{"body": $body}')
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$COMMENT_JSON" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/comments"
fi
- name: Request more info for incomplete issues - name: Request more info for incomplete issues
if: gitea.event.action == 'opened' if: gitea.event.action == 'opened'
run: | run: |
# Check if it's a bug report missing steps to reproduce LABELS=$(curl -s -H "Authorization: token $API_TOKEN" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/labels")
IS_BUG=$(echo '${{ toJSON(gitea.event.issue.labels) }}' | jq -r '.[] | select(.name == "bug") | .name') IS_BUG=$(echo "$LABELS" | jq -r '.[] | select(.name == "bug") | .name')
HAS_STEPS=$(echo '${{ gitea.event.issue.body }}' | grep -q "Steps to Reproduce" && echo "yes" || echo "no")
if [ -n "$IS_BUG" ] && [ "$HAS_STEPS" = "no" ]; then if [ -n "$IS_BUG" ] && ! echo "$ISSUE_BODY" | grep -q "Steps to Reproduce"; then
INFO_MSG="Hi @$ISSUE_AUTHOR! 👋\n\nTo help us investigate this bug, could you please provide:\n\n1. **Steps to reproduce** the issue\n2. **Expected behavior** vs **actual behavior**\n3. Your **subscription tier**\n4. **Event IDs** or **timestamps** (if applicable)\n\nThis will help us resolve the issue faster. Thanks!" INFO_MSG="Hi @$ISSUE_AUTHOR! 👋\n\nTo help us investigate this bug, could you please provide:\n\n1. **Steps to reproduce** the issue\n2. **Expected behavior** vs **actual behavior**\n3. Your **subscription tier**\n4. **Event IDs** or **timestamps** (if applicable)\n\nThis will help us resolve the issue faster. Thanks!"
COMMENT_JSON=$(jq -n --arg body "$INFO_MSG" '{"body": $body}') COMMENT_JSON=$(jq -n --arg body "$INFO_MSG" '{"body": $body}')
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$COMMENT_JSON" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/comments" curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$COMMENT_JSON" "$API_BASE_URL/repos/$REPO/issues/$ISSUE_NUMBER/comments"