Skip to content

Commit

Permalink
[reconcile]: update .github/workflows/new-issue-board-routing.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
ce-automation[bot] authored Oct 25, 2023
1 parent 036d38c commit 1dfb27e
Showing 1 changed file with 174 additions and 0 deletions.
174 changes: 174 additions & 0 deletions .github/workflows/new-issue-board-routing.yaml
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",
})

0 comments on commit 1dfb27e

Please sign in to comment.