Skip to content

Scheduling infrastructure for absolutely everyone.

chore: Merge PR labeler actions (#12987)

Keith Williamse39e6ccf791e
diff --git a/.github/workflows/apply-issue-labels-to-pr.yml b/.github/workflows/apply-issue-labels-to-pr.yml
deleted file mode 100644
index 3299b591a8a..00000000000
--- a/.github/workflows/apply-issue-labels-to-pr.yml
+++ /dev/null
@@ -1,74 +0,0 @@
-name: "Apply issue labels to PR"
-
-on:
- pull_request_target:
- types:
- - opened
-
-jobs:
- label_on_pr:
- runs-on: ubuntu-latest
-
- permissions:
- contents: none
- issues: read
- pull-requests: write
-
- steps:
- - name: Apply labels from linked issue to PR
- uses: actions/github-script@v5
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- async function getLinkedIssues(owner, repo, prNumber) {
- const query = `query GetLinkedIssues($owner: String!, $repo: String!, $prNumber: Int!) {
- repository(owner: $owner, name: $repo) {
- pullRequest(number: $prNumber) {
- closingIssuesReferences(first: 10) {
- nodes {
- number
- labels(first: 10) {
- nodes {
- name
- }
- }
- }
- }
- }
- }
- }`;
-
- const variables = {
- owner: owner,
- repo: repo,
- prNumber: prNumber,
- };
-
- const result = await github.graphql(query, variables);
- return result.repository.pullRequest.closingIssuesReferences.nodes;
- }
-
- const pr = context.payload.pull_request;
- const linkedIssues = await getLinkedIssues(
- context.repo.owner,
- context.repo.repo,
- pr.number
- );
-
- const labelsToAdd = new Set();
- for (const issue of linkedIssues) {
- if (issue.labels && issue.labels.nodes) {
- for (const label of issue.labels.nodes) {
- labelsToAdd.add(label.name);
- }
- }
- }
-
- if (labelsToAdd.size) {
- await github.rest.issues.addLabels({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: pr.number,
- labels: Array.from(labelsToAdd),
- });
- }
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index 8c5f9c18295..0ed17ef62af 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -16,3 +16,81 @@ jobs:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# https://github.com/actions/labeler/issues/442#issuecomment-1297359481
sync-labels: ""
+ team-labels:
+ permissions:
+ contents: read
+ pull-requests: write
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: equitybee/team-label-action@main
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ organization-name: calcom
+ ignore-labels: "app-store, ai, authentication, automated-testing, platform, billing, bookings, caldav, calendar-apps, ci, console, crm-apps, docs, documentation, emails, embeds, event-types, i18n, impersonation, manual-testing, ui, performance, ops-stack, organizations, public-api, routing-forms, seats, teams, webhooks, workflows, zapier"
+ apply-labels-from-issue:
+ runs-on: ubuntu-latest
+
+ permissions:
+ contents: none
+ issues: read
+ pull-requests: write
+
+ steps:
+ - name: Apply labels from linked issue to PR
+ uses: actions/github-script@v5
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ async function getLinkedIssues(owner, repo, prNumber) {
+ const query = `query GetLinkedIssues($owner: String!, $repo: String!, $prNumber: Int!) {
+ repository(owner: $owner, name: $repo) {
+ pullRequest(number: $prNumber) {
+ closingIssuesReferences(first: 10) {
+ nodes {
+ number
+ labels(first: 10) {
+ nodes {
+ name
+ }
+ }
+ }
+ }
+ }
+ }
+ }`;
+
+ const variables = {
+ owner: owner,
+ repo: repo,
+ prNumber: prNumber,
+ };
+
+ const result = await github.graphql(query, variables);
+ return result.repository.pullRequest.closingIssuesReferences.nodes;
+ }
+
+ const pr = context.payload.pull_request;
+ const linkedIssues = await getLinkedIssues(
+ context.repo.owner,
+ context.repo.repo,
+ pr.number
+ );
+
+ const labelsToAdd = new Set();
+ for (const issue of linkedIssues) {
+ if (issue.labels && issue.labels.nodes) {
+ for (const label of issue.labels.nodes) {
+ labelsToAdd.add(label.name);
+ }
+ }
+ }
+
+ if (labelsToAdd.size) {
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pr.number,
+ labels: Array.from(labelsToAdd),
+ });
+ }
diff --git a/.github/workflows/pr-assign-team-label.yml b/.github/workflows/pr-assign-team-label.yml
deleted file mode 100644
index 3004285940b..00000000000
--- a/.github/workflows/pr-assign-team-label.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-name: Assign PR team labels
-on:
- workflow_call:
- pull_request:
- branches:
- - main
-
-jobs:
- team-labels:
- permissions:
- contents: read
- pull-requests: write
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: equitybee/team-label-action@main
- with:
- repo-token: ${{ secrets.GH_ACCESS_TOKEN }}
- organization-name: calcom
- ignore-labels: "app-store, ai, authentication, automated-testing, platform, billing, bookings, caldav, calendar-apps, ci, console, crm-apps, docs, documentation, emails, embeds, event-types, i18n, impersonation, manual-testing, ui, performance, ops-stack, organizations, public-api, routing-forms, seats, teams, webhooks, workflows, zapier"