From 2436d97da35ee7764370e34af3356476c20434d4 Mon Sep 17 00:00:00 2001 From: michel Date: Mon, 6 May 2024 10:58:34 +0200 Subject: [PATCH 1/6] cleanup of devlake stuff that is not needed anymore --- .gitignore | 5 +- tools-public/devlake/docker-compose.yml | 85 ------------------------- 2 files changed, 4 insertions(+), 86 deletions(-) delete mode 100644 tools-public/devlake/docker-compose.yml diff --git a/.gitignore b/.gitignore index 54ec02a..62e73cc 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,9 @@ src .env.test.local .env.production.local +# IDE spoecific files +.idea + npm-debug.log* yarn-debug.log* yarn-error.log* @@ -53,4 +56,4 @@ packages/toolpad-app/public/typings.json packages/toolpad-app/prisma/generated -.toolpad-generated \ No newline at end of file +.toolpad-generated diff --git a/tools-public/devlake/docker-compose.yml b/tools-public/devlake/docker-compose.yml deleted file mode 100644 index 620375b..0000000 --- a/tools-public/devlake/docker-compose.yml +++ /dev/null @@ -1,85 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: "3" -services: - mysql: - image: mysql:8 - volumes: - - mysql-storage:/var/lib/mysql - restart: always - ports: - - 3306:3306 - environment: - MYSQL_ROOT_PASSWORD: admin - MYSQL_DATABASE: lake - MYSQL_USER: merico - MYSQL_PASSWORD: merico - TZ: UTC - command: --character-set-server=utf8mb4 - --collation-server=utf8mb4_bin - --skip-log-bin - --sql-mode="" - - grafana: - image: devlake.docker.scarf.sh/apache/devlake-dashboard:v0.18.0 - ports: - - 3002:3000 - volumes: - - grafana-storage:/var/lib/grafana - environment: - GF_SERVER_ROOT_URL: "http://localhost:4000/grafana" - GF_USERS_DEFAULT_THEME: "light" - MYSQL_URL: mysql:3306 - MYSQL_DATABASE: lake - MYSQL_USER: merico - MYSQL_PASSWORD: merico - TZ: UTC - restart: always - depends_on: - - mysql - - devlake: - image: devlake.docker.scarf.sh/apache/devlake:v0.18.0 - ports: - - 8080:8080 - restart: always - volumes: - - devlake-log:/app/logs - env_file: - - ./.env - environment: - LOGGING_DIR: /app/logs - TZ: UTC - depends_on: - - mysql - - config-ui: - image: devlake.docker.scarf.sh/apache/devlake-config-ui:v0.18.0 - ports: - - 4000:4000 - env_file: - - ./.env - environment: - DEVLAKE_ENDPOINT: devlake:8080 - GRAFANA_ENDPOINT: grafana:3000 - TZ: UTC - depends_on: - - devlake - -volumes: - mysql-storage: - grafana-storage: - devlake-log: From 05307b24f9a7d73e81b66a07d106eda779449126 Mon Sep 17 00:00:00 2001 From: michel Date: Mon, 6 May 2024 10:59:41 +0200 Subject: [PATCH 2/6] fix typo --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 62e73cc..9486446 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ src .env.test.local .env.production.local -# IDE spoecific files +# IDE specific files .idea npm-debug.log* From 8e1c077fb73dbf27e3adc41b3d874116d41943e1 Mon Sep 17 00:00:00 2001 From: michel Date: Mon, 6 May 2024 11:16:46 +0200 Subject: [PATCH 3/6] adds a reusable workflow to the workflows for assigning reviewers based on a team slug --- .github/workflows/add-reviewers-to-pr.yml | 52 +++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/add-reviewers-to-pr.yml diff --git a/.github/workflows/add-reviewers-to-pr.yml b/.github/workflows/add-reviewers-to-pr.yml new file mode 100644 index 0000000..9fc6459 --- /dev/null +++ b/.github/workflows/add-reviewers-to-pr.yml @@ -0,0 +1,52 @@ +name: Add reviewers to PRs + +on: + pull_request_target: + branches: ['master', 'next'] + types: ['labeled'] + workflow_call: + inputs: + team-slug: + description: 'The slug of the team from which reviewers get collected' + required: true + type: string + label-name: + description: 'The name of the label that triggers the action' + required: true + type: string + secrets: + gh-token: + description: 'The github token to use for the API calls. You can use the GITHUB_TOKEN secret' + required: true + type: string + +permissions: {} + +jobs: + add-reviewers-to-pr: + # Tests that label is added on the PR + if: ${{ github.event.label.name == inputs.label-name }} + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - id: get-members + run: | + DATA=$(gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /orgs/${{ github.repository_owner }}/teams/${{ inputs.team-slug }}/members?role=maintainer&per_page=100 \ + | jq 'reduce inputs as $i (.; . += $i)') \ + echo "data=$DATA" >> $GITHUB_OUTPUT + + # assign reviewers + - id: assign-reviewers + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.gh-token }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository_owner }}/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ + -d '{"reviewers":[${{ join(fromJson(steps.get-members.outputs.data).*.login) }}]}' \ From 459b2741c284e49891c45abe0ee331669a16a010 Mon Sep 17 00:00:00 2001 From: michel Date: Mon, 6 May 2024 11:17:58 +0200 Subject: [PATCH 4/6] changed name to reusable-... to indicate that it is intended to be reused and not as a standalone action --- .../{add-reviewers-to-pr.yml => reusable-add-reviewers-to-pr.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{add-reviewers-to-pr.yml => reusable-add-reviewers-to-pr.yml} (100%) diff --git a/.github/workflows/add-reviewers-to-pr.yml b/.github/workflows/reusable-add-reviewers-to-pr.yml similarity index 100% rename from .github/workflows/add-reviewers-to-pr.yml rename to .github/workflows/reusable-add-reviewers-to-pr.yml From 0e2ea050b182061e5396921b4c6174344a7de0b4 Mon Sep 17 00:00:00 2001 From: michel Date: Mon, 6 May 2024 11:23:51 +0200 Subject: [PATCH 5/6] changed var name gh-token > token --- .github/workflows/reusable-add-reviewers-to-pr.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-add-reviewers-to-pr.yml b/.github/workflows/reusable-add-reviewers-to-pr.yml index 9fc6459..31913c8 100644 --- a/.github/workflows/reusable-add-reviewers-to-pr.yml +++ b/.github/workflows/reusable-add-reviewers-to-pr.yml @@ -1,9 +1,10 @@ name: Add reviewers to PRs on: + pull_request: + types: ['labeled'] pull_request_target: branches: ['master', 'next'] - types: ['labeled'] workflow_call: inputs: team-slug: @@ -15,7 +16,7 @@ on: required: true type: string secrets: - gh-token: + token: description: 'The github token to use for the API calls. You can use the GITHUB_TOKEN secret' required: true type: string @@ -46,7 +47,7 @@ jobs: curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.gh-token }}" \ + -H "Authorization: Bearer ${{ secrets.token }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/${{ github.repository_owner }}/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ -d '{"reviewers":[${{ join(fromJson(steps.get-members.outputs.data).*.login) }}]}' \ From 0419baa144c4613846aac288d2ed3cc62867461c Mon Sep 17 00:00:00 2001 From: Michel Engelen <32863416+michelengelen@users.noreply.github.com> Date: Mon, 6 May 2024 12:22:01 +0200 Subject: [PATCH 6/6] Update .github/workflows/reusable-add-reviewers-to-pr.yml Co-authored-by: Jose C Quintas Jr Signed-off-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com> --- .github/workflows/reusable-add-reviewers-to-pr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/reusable-add-reviewers-to-pr.yml b/.github/workflows/reusable-add-reviewers-to-pr.yml index 31913c8..2de3160 100644 --- a/.github/workflows/reusable-add-reviewers-to-pr.yml +++ b/.github/workflows/reusable-add-reviewers-to-pr.yml @@ -1,10 +1,9 @@ name: Add reviewers to PRs on: - pull_request: - types: ['labeled'] pull_request_target: branches: ['master', 'next'] + types: ['labeled'] workflow_call: inputs: team-slug: