From 519df470b6ba1a024f7d2727af63bff62488df86 Mon Sep 17 00:00:00 2001 From: 0x1026 <69076992+0x1026@users.noreply.github.com> Date: Sat, 7 Dec 2024 18:01:56 +0100 Subject: [PATCH] chore(workflows): add third-party action notices and cleanup CI/CD workflows --- .github/workflows/build.yml | 5 +++ .github/workflows/cd.yml | 5 +++ .github/workflows/ci.yml | 38 ------------------- .github/workflows/pr-labeler.yml | 23 ------------ .github/workflows/pr.yml | 64 ++++++++++++++++++++++++++++++++ .github/workflows/report.yml | 5 +++ .github/workflows/stale.yml | 1 + 7 files changed, 80 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/pr-labeler.yml create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a850a1c..798d336 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,8 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + name: ๐Ÿ—๏ธ Build run-name: ๐Ÿณ Building Docker images diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 7603183..30bd729 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,3 +1,8 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + name: ๐ŸŒณ Continuous Deployment run-name: ๐Ÿš€ Deploying the app to production diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db21386..6ccd49d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,51 +8,13 @@ name: ๐ŸŒณ Continous Integration run-name: ๐ŸŒฑ Checking integrity of the app on: - pull_request: - types: [opened, synchronize, reopened, closed] push: branches: ["**", "!main"] jobs: - cleanup: - name: ๐Ÿงน Cleanup cache - runs-on: ubuntu-latest - if: github.event.action == 'closed' - permissions: - # `actions:write` permission is required to delete caches - # See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id - actions: write - contents: read - - steps: - # https://github.com/actions/checkout/tree/11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - - name: ๐Ÿ—‘๏ธ Delete cache - run: | - gh extension install actions/gh-actions-cache - - REPO=${{ github.repository }} - BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge - - echo "Fetching list of cache key" - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) - - ## Setting this to not fail the workflow while deleting cache keys. - set +e - echo "Deleting caches..." - for cacheKey in $cacheKeysForPR - do - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm - done - echo "Done" - env: - GH_TOKEN: ${{ github.token }} - foundation: name: ๐ŸŒฑ Foundation setup runs-on: ubuntu-latest - if: github.event.action != 'closed' permissions: pull-requests: read outputs: diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml deleted file mode 100644 index 17fdb7f..0000000 --- a/.github/workflows/pr-labeler.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This workflow will triage pull requests and apply a label based on the -# paths that are modified in the pull request. -# -# To use this workflow, you will need to set up a .github/labeler.yml -# file with configuration. For more information, see: -# https://github.com/actions/labeler - -name: Pull Request Labeler - -on: [pull_request_target] - -jobs: - label: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - - steps: - # https://github.com/actions/labeler/tree/8558fd74291d67161a8a78ce36a881fa63b766a9 - - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 - with: - sync-labels: true diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..c27f03e --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,64 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: ๐ŸŒณ Pull Request + +on: + pull_request_target: + pull_request: + types: + - closed + +jobs: + # To use this job, you will need to set up a .github/labeler.yml + # file with configuration. For more information, see: + # https://github.com/actions/labeler + label: + name: ๐Ÿท๏ธ Label + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + + steps: + # https://github.com/actions/labeler/tree/8558fd74291d67161a8a78ce36a881fa63b766a9 + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 + with: + sync-labels: true + + cleanup-cache: + name: ๐Ÿงน Cleanup cache + runs-on: ubuntu-latest + if: github.event.action == 'closed' + permissions: + # `actions:write` permission is required to delete caches + # See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id + actions: write + contents: read + + steps: + # https://github.com/actions/checkout/tree/11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + + - name: ๐Ÿ—‘๏ธ Delete cache + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + done + echo "Done" + env: + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 7270450..b9ef123 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -1,3 +1,8 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + name: ๐Ÿ—ƒ๏ธ Report run-name: ๐Ÿ—‚๏ธ Reporting coverage data to Codecov, and release to Sentry diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index b595f3d..668243d 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -5,6 +5,7 @@ # https://github.com/actions/stale name: Mark stale issues and pull requests + on: schedule: - cron: "30 21 * * *"