Skip to content

app.music-assistant.io remote access times out #3486

app.music-assistant.io remote access times out

app.music-assistant.io remote access times out #3486

name: Response State Tracker
on:
issues:
types: [opened, reopened]
issue_comment:
types: [created]
permissions:
issues: write
jobs:
track-response-state:
runs-on: ubuntu-latest
# Only run on issues, not PRs (issue_comment fires for both)
if: >
(github.event_name == 'issues') ||
(github.event_name == 'issue_comment' && !github.event.issue.pull_request)
steps:
- name: Handle new or reopened issue
if: github.event_name == 'issues'
uses: actions/github-script@v8
with:
script: |
const issue = context.payload.issue;
// Add needs-attention label
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['needs-attention']
});
// Remove waiting-for-user and stale if present (relevant for reopened issues)
for (const label of ['waiting-for-user', 'stale']) {
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
name: label
});
} catch (e) {
// Label not present, ignore
}
}
- name: Handle comment on issue
if: github.event_name == 'issue_comment'
uses: actions/github-script@v8
with:
script: |
const comment = context.payload.comment;
const issue = context.payload.issue;
const commenterLogin = comment.user.login;
const commenterAssociation = comment.author_association;
const issueAuthorLogin = issue.user.login;
// Skip bot comments entirely
if (comment.user.type === 'Bot') {
console.log(`Skipping bot comment from ${commenterLogin}`);
return;
}
// Check if commenter is a member of the music-assistant org
let isOrgMember = false;
try {
const res = await github.rest.orgs.checkMembershipForUser({
org: 'music-assistant',
username: commenterLogin
});
// 204 = member, 302 = not a member (redirects to public check)
isOrgMember = (res.status === 204);
} catch (e) {
// 404 = not a member, or insufficient permissions
isOrgMember = false;
}
// Fall back to author_association if org check fails
const maintainerAssociations = ['OWNER', 'MEMBER', 'COLLABORATOR'];
const isMaintainer = isOrgMember || maintainerAssociations.includes(commenterAssociation);
// Determine if commenter is the issue author
const isIssueAuthor = (commenterLogin === issueAuthorLogin);
const currentLabels = issue.labels.map(l => l.name);
// Labels that indicate the issue is confirmed/tracked — skip response-state changes
const skipLabels = ['bug', 'Fix to be Confirmed'];
const hasSkipLabel = skipLabels.some(l => currentLabels.includes(l));
if (hasSkipLabel) {
console.log(`Skipping response-state change: issue has ${skipLabels.filter(l => currentLabels.includes(l))}`);
return;
}
if (isMaintainer && !isIssueAuthor) {
// A maintainer (who is not the issue author) responded
// Remove needs-attention, add waiting-for-user
if (currentLabels.includes('needs-attention')) {
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
name: 'needs-attention'
});
} catch (e) { /* not present */ }
}
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['waiting-for-user']
});
// Remove stale label if present
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
name: 'stale'
});
} catch (e) { /* not present */ }
} else if (isIssueAuthor) {
// The issue author responded
// Remove waiting-for-user, add needs-attention
if (currentLabels.includes('waiting-for-user')) {
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
name: 'waiting-for-user'
});
} catch (e) { /* not present */ }
}
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['needs-attention']
});
// Remove stale label if present
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
name: 'stale'
});
} catch (e) { /* not present */ }
}
// If commenter is neither maintainer nor issue author (community member),
// do nothing to the response-state labels.