Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Handle existing stack label in CI labelling job (#3413)
Dhruv Bhanushalif121949b3318
diff --git a/.github/filters.yml b/.github/filters.ymlindex 97ed80ac0..52378c5b2 100644--- a/.github/filters.yml+++ b/.github/filters.yml@@ -64,6 +64,7 @@ mgmt:- .github/**- .devcontainer/**- automations/**+ - utilities/**ci_cd:- .github/actions/**- .github/workflows/ci_cd.ymldiff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex c010fb248..c404296ab 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -134,20 +134,31 @@ jobs:# - list of stack filters: `.github/filters.yml`# - list of stack labels: https://github.com/WordPress/openverse/labels?q=stackscript: |- const stacks = ["catalog", "api", "ingestion_server", "frontend", "documentation", "mgmt"]- const labels = JSON- .parse('${{ needs.get-changes.outputs.changes }}')- .filter(change => stacks.includes(change))- .map(change => `🧱 stack: ${change.replace("_", " ")}`)- if (!labels.length) {- labels.push("🚦 status: awaiting triage", "🏷 status: label work required")- }- github.rest.issues.addLabels({+ const labels = await github.rest.issues.listLabelsOnIssue({issue_number: context.issue.number,owner: context.repo.owner,repo: context.repo.repo,- labels,})+ console.log(labels.data)+ if (labels.data.some(label => label.name.startsWith("🧱 stack: "))) {+ console.log("Stack label already applied, skipping.")+ } else {+ const stacks = ["catalog", "api", "ingestion_server", "frontend", "documentation", "mgmt"]+ const labels = JSON+ .parse('${{ needs.get-changes.outputs.changes }}')+ .filter(change => stacks.includes(change))+ .map(change => `🧱 stack: ${change.replace("_", " ")}`)+ if (!labels.length) {+ console.log("Couldn't determine stack, applying triage labels.")+ labels.push("🚦 status: awaiting triage", "🏷 status: label work required")+ }+ await github.rest.issues.addLabels({+ issue_number: context.issue.number,+ owner: context.repo.owner,+ repo: context.repo.repo,+ labels,+ })+ }build-images:name: Build Docker images