forked from replicatedhq/troubleshoot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[reconcile]: update .github/workflows/new-issue-board-routing.yaml
- Loading branch information
1 parent
f301fc0
commit f364dff
Showing
1 changed file
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
--- | ||
on: | ||
issues: | ||
types: [opened] | ||
|
||
name: Issue Comments | ||
jobs: | ||
ie-project: | ||
name: Add issue to the Inbound Escalations project | ||
runs-on: ubuntu-latest | ||
if: "contains(join(github.event.issue.labels.*.name, ' '), 'inbound-escalation')" | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const PROJECT_NAME = "Inbound Escalations"; | ||
const COLUMN = "New"; | ||
const projects = await github.rest.projects.listForRepo({ | ||
owner: context.payload.repository.owner.login, | ||
repo: context.payload.repository.name, | ||
}); | ||
// there should always be exactly one | ||
const proj = projects.data.filter( | ||
(p) => p.name.indexOf(PROJECT_NAME) !== -1 | ||
)[0]; | ||
if (!proj) { | ||
core.setFailed("Could not find a project called " + PROJECT_NAME); | ||
} | ||
core.info("found project " + PROJECT_NAME); | ||
const columns = await github.rest.projects.listColumns({ | ||
project_id: proj.id, | ||
}); | ||
const column = columns.data.filter( | ||
(c) => c.name.indexOf(COLUMN) !== -1 | ||
)[0]; | ||
if (!column) { | ||
core.setFailed("Could not find a column called " + COLUMN); | ||
} | ||
core.info("found column " + COLUMN); | ||
await github.rest.projects.createCard({ | ||
column_id: column.id, | ||
content_id: context.payload.issue.id, | ||
content_type: "Issue", | ||
}) | ||
npi-project: | ||
name: Add issue to the New Production Installs project | ||
runs-on: ubuntu-latest | ||
if: "contains(join(github.event.issue.labels.*.name, ' '), 'kind::customer')" | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const PROJECT_NAME = "New Production Installs"; | ||
const COLUMN = "Not Ready"; | ||
const projects = await github.rest.projects.listForRepo({ | ||
owner: context.payload.repository.owner.login, | ||
repo: context.payload.repository.name, | ||
}); | ||
// there should always be exactly one | ||
const proj = projects.data.filter( | ||
(p) => p.name.indexOf(PROJECT_NAME) !== -1 | ||
)[0]; | ||
if (!proj) { | ||
core.setFailed("Could not find a project called " + PROJECT_NAME); | ||
} | ||
core.info("found project " + PROJECT_NAME); | ||
const columns = await github.rest.projects.listColumns({ | ||
project_id: proj.id, | ||
}); | ||
const column = columns.data.filter( | ||
(c) => c.name.indexOf(COLUMN) !== -1 | ||
)[0]; | ||
if (!column) { | ||
core.setFailed("Could not find a column called " + COLUMN); | ||
} | ||
core.info("found column " + COLUMN); | ||
await github.rest.projects.createCard({ | ||
column_id: column.id, | ||
content_id: context.payload.issue.id, | ||
content_type: "Issue", | ||
}) | ||
enhancements-project: | ||
name: Add issue to the Enhancements project | ||
runs-on: ubuntu-latest | ||
if: > | ||
( | ||
contains(join(github.event.issue.labels.*.name, ' '), 'kind::bug') | ||
|| contains(join(github.event.issue.labels.*.name, ' '), 'kind::feature-request') | ||
) | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const PROJECT_NAME = "Enhancements"; | ||
const trackedLabel = context.payload.issue.labels.filter(label => label.name === "enhancements::tracked"); | ||
const COLUMN = trackedLabel.length ? "Tracked" : "New"; | ||
const projects = await github.rest.projects.listForRepo({ | ||
owner: context.payload.repository.owner.login, | ||
repo: context.payload.repository.name, | ||
}); | ||
// there should always be exactly one | ||
const proj = projects.data.filter( | ||
(p) => p.name.indexOf(PROJECT_NAME) !== -1 | ||
)[0]; | ||
if (!proj) { | ||
core.setFailed("Could not find a project called " + PROJECT_NAME); | ||
} | ||
core.info("found project " + PROJECT_NAME); | ||
const columns = await github.rest.projects.listColumns({ | ||
project_id: proj.id, | ||
}); | ||
const column = columns.data.filter( | ||
(c) => c.name.indexOf(COLUMN) !== -1 | ||
)[0]; | ||
if (!column) { | ||
core.setFailed("Could not find a column called " + COLUMN); | ||
} | ||
core.info("found column " + COLUMN); | ||
await github.rest.projects.createCard({ | ||
column_id: column.id, | ||
content_id: context.payload.issue.id, | ||
content_type: "Issue", | ||
}) | ||
packaging-project: | ||
name: Add issue to the Packaging project | ||
runs-on: ubuntu-latest | ||
if: > | ||
( | ||
contains(join(github.event.issue.labels.*.name, ' '), 'kind::packaging-step') | ||
) | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const PROJECT_NAME = "Packaging Steps"; | ||
const trackedLabel = context.payload.issue.labels.filter(label => label.name === "packaging::started"); | ||
const COLUMN = trackedLabel.length ? "In Progress" : "To Do"; | ||
const projects = await github.rest.projects.listForRepo({ | ||
owner: context.payload.repository.owner.login, | ||
repo: context.payload.repository.name, | ||
}); | ||
// there should always be exactly one | ||
const proj = projects.data.filter( | ||
(p) => p.name.indexOf(PROJECT_NAME) !== -1 | ||
)[0]; | ||
if (!proj) { | ||
core.setFailed("Could not find a project called " + PROJECT_NAME); | ||
} | ||
core.info("found project " + PROJECT_NAME); | ||
const columns = await github.rest.projects.listColumns({ | ||
project_id: proj.id, | ||
}); | ||
const column = columns.data.filter( | ||
(c) => c.name.indexOf(COLUMN) !== -1 | ||
)[0]; | ||
if (!column) { | ||
core.setFailed("Could not find a column called " + COLUMN); | ||
} | ||
core.info("found column " + COLUMN); | ||
await github.rest.projects.createCard({ | ||
column_id: column.id, | ||
content_id: context.payload.issue.id, | ||
content_type: "Issue", | ||
}) |