diff --git a/.github/workflows/add-backport-label.yaml b/.github/workflows/add-backport-label.yaml deleted file mode 100644 index 5f033f3cd2..0000000000 --- a/.github/workflows/add-backport-label.yaml +++ /dev/null @@ -1,91 +0,0 @@ -name: Add backport label - -on: - pull_request: - types: - - opened - - synchronize - - reopened - - edited - - labeled - - unlabeled - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - check-issues: - if: ${{ github.event.label.name != 'auto-backport' }} - runs-on: ubuntu-latest - steps: - - name: Checkout code to get gh-utils script - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - uses: actions/checkout@v4 - - - name: Determine whether to add label - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CONTAINS_AUTO_BACKPORT: ${{ contains(github.event.pull_request.labels.*.name, 'auto-backport') }} - id: add_label - run: | - pr=${{ github.event.pull_request.number }} - linked_issues=$(./ci/gh-util.sh \ - list-issues-for-pr "$pr" |\ - grep -v "^\#" || true) - [ -z "${linked_issues}" ] && { - echo "::error::No linked issues for PR $pr" - exit 1 - } - has_bug=false - for issue in $(echo "$linked_issues") - do - labels=$(./ci/gh-util.sh list-labels-for-issue "$issue") - - label_names=$(echo $labels | jq -r '.labels[].name' || true) - if [[ "$label_names" =~ "bug" ]]; then - has_bug=true - break - fi - done - - has_backport_needed_label=${{ contains(github.event.pull_request.labels.*.name, 'needs-backport') }} - has_no_backport_needed_label=${{ contains(github.event.pull_request.labels.*.name, 'no-backport-needed') }} - - echo "add_backport_label=false" >> $GITHUB_OUTPUT - if [ $has_backport_needed_label = true ] || [ $has_bug = true ]; then - if [[ $has_no_backport_needed_label = false ]]; then - echo "add_backport_label=true" >> $GITHUB_OUTPUT - fi - fi - - # Do not spam comment, only if auto-backport label is going to be newly added. - echo "auto_backport_added=$CONTAINS_AUTO_BACKPORT" >> $GITHUB_OUTPUT - - - name: Add comment - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') && steps.add_label.outputs.add_backport_label == 'true' && steps.add_label.outputs.auto_backport_added == 'false' }} - uses: actions/github-script@v6 - with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'This issue has been marked for auto-backporting. Add label(s) backport-to-BRANCHNAME to backport to them' - }) - - # Allow label to be removed by adding no-backport-needed label - - name: Remove auto-backport label - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') && steps.add_label.outputs.add_backport_label == 'false' }} - uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90 - with: - remove-labels: "auto-backport" - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Add auto-backport label - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') && steps.add_label.outputs.add_backport_label == 'true' }} - uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90 - with: - add-labels: "auto-backport" - repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/auto-backport.yaml b/.github/workflows/auto-backport.yaml deleted file mode 100644 index e2be390227..0000000000 --- a/.github/workflows/auto-backport.yaml +++ /dev/null @@ -1,33 +0,0 @@ -on: - pull_request_target: - types: ["labeled", "closed"] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - backport: - name: Backport PR - runs-on: ubuntu-latest - if: | - github.event.pull_request.merged == true - && contains(github.event.pull_request.labels.*.name, 'auto-backport') - && ( - (github.event.action == 'labeled' && github.event.label.name == 'auto-backport') - || (github.event.action == 'closed') - ) - steps: - - name: Backport Action - uses: sqren/backport-github-action@v8.9.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - auto_backport_label_prefix: backport-to- - - - name: Info log - if: ${{ success() }} - run: cat /home/runner/.backport/backport.info.log - - - name: Debug log - if: ${{ failure() }} - run: cat /home/runner/.backport/backport.debug.log diff --git a/.github/workflows/require-pr-porting-labels.yaml b/.github/workflows/require-pr-porting-labels.yaml deleted file mode 100644 index e1b0c9c7d8..0000000000 --- a/.github/workflows/require-pr-porting-labels.yaml +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2020 Intel Corporation -# -# SPDX-License-Identifier: Apache-2.0 -# - -name: Ensure PR has required porting labels - -on: - pull_request_target: - types: - - opened - - reopened - - labeled - - unlabeled - branches: - - main - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - check-pr-porting-labels: - runs-on: ubuntu-latest - steps: - - name: Install hub - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - run: | - HUB_ARCH="amd64" - HUB_VER=$(curl -sL "https://api.github.com/repos/github/hub/releases/latest" |\ - jq -r .tag_name | sed 's/^v//') - curl -sL \ - "https://github.com/github/hub/releases/download/v${HUB_VER}/hub-linux-${HUB_ARCH}-${HUB_VER}.tgz" |\ - tar xz --strip-components=2 --wildcards '*/bin/hub' && \ - sudo install hub /usr/local/bin - - - name: Checkout code to allow hub to communicate with the project - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Rebase atop of the latest target branch - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - run: | - ./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch" - env: - TARGET_BRANCH: ${{ github.event.pull_request.base.ref }} - - - name: Install porting checker script - run: | - # Clone into a temporary directory to avoid overwriting - # any existing github directory. - pushd $(mktemp -d) &>/dev/null - git clone --single-branch --depth 1 "https://github.com/kata-containers/.github" && cd .github/scripts - sudo install pr-porting-checks.sh /usr/local/bin - popd &>/dev/null - - - name: Stop PR being merged unless it has a correct set of porting labels - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - env: - GITHUB_TOKEN: ${{ secrets.KATA_GITHUB_ACTIONS_TOKEN }} - run: | - pr=${{ github.event.number }} - repo=${{ github.repository }} - - pr-porting-checks.sh "$pr" "$repo"