From 41aa27e711a38c3e78c283029c6df0d94169082b Mon Sep 17 00:00:00 2001 From: kranurag7 Date: Fri, 1 Mar 2024 11:06:22 +0530 Subject: [PATCH 1/3] automate adding labels to pull requests this commit uses actions/labeler to automate adding Container labels to pull requests. For renovate PRs, it extends renovate configuration so that renovate adds Container label to the PR when a new dependency upgrade pull request is created. Signed-off-by: kranurag7 --- .github/labeler.yaml | 27 ++++++++++++++++++--------- .github/labels.yaml | 4 ++++ .github/renovate.json5 | 1 + .github/workflows/pr-verify.yml | 19 +++++++++++++++++++ 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/.github/labeler.yaml b/.github/labeler.yaml index 8d3ced06..9f9d6954 100644 --- a/.github/labeler.yaml +++ b/.github/labeler.yaml @@ -1,16 +1,25 @@ --- area/code: - - "controllers/**/*" - - "pkg/**/*" + - changed-files: + - any-glob-to-any-file: "controllers/**/*" + - any-glob-to-any-file: "pkg/**/*" area/api: - - "api/**/*" - - "config/crd/**/*" + - changed-files: + - any-glob-to-any-file: "api/**/*" + - any-glob-to-any-file: "config/crd/**/*" area/github: - - ".github/**/*" + - changed-files: + - any-glob-to-any-file: ".github/**/*" area/hack: - - "hack/**/*" - - "Makefile" + - changed-files: + - any-glob-to-any-file: "hack/**/*" + - any-glob-to-any-file: "Makefile" area/test: - - "test/**/*" + - changed-files: + - any-glob-to-any-file: "test/**/*" area/templates: - - "templates/**/*" + - changed-files: + - any-glob-to-any-file: "templates/**/*" +Container: + - changed-files: + - any-glob-to-any-file: '**' diff --git a/.github/labels.yaml b/.github/labels.yaml index 3f5706ff..5b235251 100644 --- a/.github/labels.yaml +++ b/.github/labels.yaml @@ -78,3 +78,7 @@ color: "7B55D7" - name: question color: "cc317c" +- name: Container + color: "0dce67" + description: >- + Container Infra and Tooling. diff --git a/.github/renovate.json5 b/.github/renovate.json5 index dcd6b6be..ee9ee6a4 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -44,4 +44,5 @@ separateMinorPatch: true, enabledManagers: ["dockerfile", "gomod", "github-actions", "regex"], recreateClosed: true, + labels: ["Container"] } diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index 0e9ac3c1..2b08ed9a 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -22,3 +22,22 @@ jobs: - name: Verify Shellcheck run: make verify-shellcheck + + - name: Generate Token + uses: actions/create-github-app-token@e8e39f73bb84fdf315a015fa3104f314c0a258b4 # v1 + id: generate-token + with: + app-id: ${{ secrets.SCS_APP_ID }} + private-key: ${{ secrets.SCS_APP_PRIVATE_KEY }} + + - name: Generate Labels + uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5 + with: + configuration-path: .github/labeler.yaml + repo-token: ${{ steps.generate-token.outputs.token }} + + - name: Sync Labels + uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2 + with: + config-file: .github/labels.yaml + token: ${{ steps.generate-token.outputs.token }} From 907a67d20a2b29b18150138b2ecc3df3e8437494 Mon Sep 17 00:00:00 2001 From: kranurag7 Date: Sat, 2 Mar 2024 01:26:00 +0530 Subject: [PATCH 2/3] automate labeling issues and adding to projects Signed-off-by: kranurag7 --- .github/workflows/issues.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/issues.yaml diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml new file mode 100644 index 00000000..86ba9ba1 --- /dev/null +++ b/.github/workflows/issues.yaml @@ -0,0 +1,29 @@ +name: Label issues And add to projects +on: + issues: + types: + - reopened + - opened +jobs: + label_issues: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - run: gh issue edit "$NUMBER" --add-label "$LABELS" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + LABELS: Container + + add-to-project: + name: Add pull request to project + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@v0.5.0 + with: + project-url: https://github.com/orgs/SovereignCloudStack/projects/6/views/7 + github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} + labeled: Container + label-operator: AND From 8b62567e4d03901eb3740c801959ebfecbcfe6e5 Mon Sep 17 00:00:00 2001 From: Jan Schoone <6106846+jschoone@users.noreply.github.com> Date: Fri, 1 Mar 2024 21:41:06 +0100 Subject: [PATCH 3/3] fix(add-to-project): view id not needed in project-url Signed-off-by: Jan Schoone <6106846+jschoone@users.noreply.github.com> --- .github/workflows/issues.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml index 86ba9ba1..2386e5fc 100644 --- a/.github/workflows/issues.yaml +++ b/.github/workflows/issues.yaml @@ -23,7 +23,7 @@ jobs: steps: - uses: actions/add-to-project@v0.5.0 with: - project-url: https://github.com/orgs/SovereignCloudStack/projects/6/views/7 + project-url: https://github.com/orgs/SovereignCloudStack/projects/6 github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} labeled: Container label-operator: AND