Skip to content

feat(workflows): Add internal package dependencies to existing workflows #3170

feat(workflows): Add internal package dependencies to existing workflows

feat(workflows): Add internal package dependencies to existing workflows #3170

Workflow file for this run

name: Auto-assign issue on /attempt comment
on:
issue_comment:
types: [created]
jobs:
auto-assign:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const comment = context.payload.comment;
const issue = context.issue;
const owner = "keyshade-xyz";
const repo = "keyshade";
async function updateProjectStatus(issueNumber) {
const projectsResponse = await github.rest.projects.listForRepo({
owner,
repo,
per_page: 100,
});
for (const project of projectsResponse.data) {
const columnsResponse = await github.rest.projects.listColumns({
project_id: project.id,
per_page: 100,
});
const inProgressColumn = columnsResponse.data.find(column => column.name === "In Progress");
if (!inProgressColumn) continue;
const cardsResponse = await github.rest.projects.listCards({
column_id: inProgressColumn.id,
per_page: 100,
});
const issueCardExists = cardsResponse.data.some(card => card.content_id === issueNumber && card.content_type === "Issue");
if (!issueCardExists) {
await github.rest.projects.createCard({
column_id: inProgressColumn.id,
content_id: issueNumber,
content_type: "Issue",
});
}
}
}
if (comment.body.startsWith('/attempt')) {
if (!issue.assignee) {
await github.rest.issues.addAssignees({
owner,
repo,
issue_number: issue.number,
assignees: [comment.user.login],
});
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: `Assigned the issue to @${comment.user.login}!`,
});
await updateProjectStatus(issue.number);
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'This issue is already assigned. Tag a maintainer if you need to take over.',
});
}
}