From 9288f34ac2e3b491e8d456197f41db6df41d0efd Mon Sep 17 00:00:00 2001 From: schmidtw Date: Sat, 30 Mar 2024 18:17:26 -0700 Subject: [PATCH] Add a cleanup action. --- .github/workflows/cleanup-tags.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/cleanup-tags.yml diff --git a/.github/workflows/cleanup-tags.yml b/.github/workflows/cleanup-tags.yml new file mode 100644 index 0000000..1b50e70 --- /dev/null +++ b/.github/workflows/cleanup-tags.yml @@ -0,0 +1,29 @@ +# SPDX-FileCopyrightText: 2024 Comcast Cable Communications Management, LLC +# SPDX-License-Identifier: Apache-2.0 +--- + name: 'Cleanup testing tags.' + + on: + schedule: + - cron: '52 1 * * 1' # Monday at 1:52am UTC clean everything up + workflow_dispatch: + + jobs: + remove-tags: + runs-on: [ ubuntu-latest ] + steps: + - name: Checkout the code + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + token: ${{ secrets.PUSH_TAG_TOKEN }} + + - name: Search for v1.x.x or v2.x.x tags to remove + shell: bash + run: | + mapfile -t tags< <(git tag | grep "v[12]\.") + for tag in "${tags[@]}"; do + echo "Removing $tag" + git tag -d $tag + git push origin :refs/tags/$tag + done \ No newline at end of file