# # # @type github workflow # @desc cleans up the list of deployments in the environment history # edit the 'environment:' to determine which deployment to keep clean # - can be ran manually # @author Aetherinox # @url https://github.com/Aetherinox # # @secrets secrets.SELF_TOKEN_CL Github Access Token (Classic) # secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKfLOWS Discord Webbhook URL; right-click on channel, click "Integrations" # # # # name: "⚙️ Deploy › Clean" run-name: "⚙️ Deploy › Clean" # # # triggers # # on: workflow_dispatch: inputs: # # # Deployment Environment Name # # this is the name of the deployment item # # DEPLOYMENT_ENV: description: '📦 Deployment Environment' required: true default: 'orion' type: string # # # Delay # # Milliseconds to wait between cleaning up each action in history. Avoids secondary rate limit. Default: 500 # # DEPLOYMENT_DELAY: description: '🕛 Delete Delay' required: true default: '1000' type: string # # # environment variables # # env: DEPLOYMENT_ENV: ${{ github.event.inputs.DEPLOYMENT_ENV || 'orion' }} DEPLOYMENT_DELAY: ${{ github.event.inputs.DEPLOYMENT_DELAY || '1000' }} BOT_NAME_1: EuropaServ BOT_NAME_DEPENDABOT: dependabot[bot] LABELS_JSON: | [ { "name": "AC › Changes Made", "color": "8F1784", "description": "Requested changes have been made and are pending a re-scan" }, { "name": "AC › Changes Required", "color": "8F1784", "description": "Requires changes to be made to the package before being accepted" }, { "name": "AC › Failed", "color": "a61f2d", "description": "Autocheck failed to run through a complete cycle, requires investigation" }, { "name": "AC › Needs Rebase", "color": "8F1784", "description": "Due to the permissions on the requesting repo, this pull request must be rebased by the author" }, { "name": "AC › Passed", "color": "146b4a", "description": "Ready to be reviewed" }, { "name": "AC › Review Required", "color": "8F1784", "description": "PR needs to be reviewed by another person, after the requested changes have been made" }, { "name": "AC › Security Warning", "color": "761620", "description": "Does not conform to developer policies, or includes potentially dangerous code" }, { "name": "AC › Skipped Scan", "color": "8F1784", "description": "Author has skipped code scan" }, { "name": "Status 𐄂 Duplicate", "color": "75536b", "description": "Issue or pull request already exists" }, { "name": "Status 𐄂 Accepted", "color": "2e7539", "description": "This pull request has been accepted" }, { "name": "Status 𐄂 Autoclosed", "color": "3E0915", "description": "Originally stale and was autoclosed for no activity" }, { "name": "Status 𐄂 Denied", "color": "ba4058", "description": "Pull request has been denied" }, { "name": "Status 𐄂 Locked", "color": "550F45", "description": "Automatically locked by EuropaServ for a prolonged period of inactivity" }, { "name": "Status 𐄂 Need Info", "color": "2E3C4C", "description": "Not enough information to resolve" }, { "name": "Status 𐄂 No Action", "color": "030406", "description": "Closed without any action being taken" }, { "name": "Status 𐄂 Pending", "color": "984b12", "description": "Pending pull request" }, { "name": "Status 𐄂 Released", "color": "1b6626", "description": "Issues or PR has been implemented and is now live" }, { "name": "Status 𐄂 Reopened", "color": "8a6f14", "description": "A previously closed PR which has been re-opened" }, { "name": "Status 𐄂 Review", "color": "9e1451", "description": "Currently pending review" }, { "name": "Status 𐄂 Stale", "color": "928282", "description": "Has not had any activity in over 30 days" }, { "name": "Type ◦ Bug", "color": "9a2c2c", "description": "Something isn't working" }, { "name": "Type ◦ Dependency", "color": "243759", "description": "Item is associated to dependency" }, { "name": "Type ◦ Docs", "color": "0e588d", "description": "Improvements or modifications to docs" }, { "name": "Type ◦ Feature", "color": "3c4e93", "description": "Feature request" }, { "name": "Type ◦ Git Action", "color": "030406", "description": "GitHub Action / workflow" }, { "name": "Type ◦ Pull Request", "color": "8F1784", "description": "Normal pull request" }, { "name": "Type ◦ Roadmap", "color": "8F1784", "description": "Feature or bug currently planned for implementation" }, { "name": "Type ◦ Internal", "color": "A51994", "description": "Assigned items are for internal developer use" }, { "name": "Build ◦ Desktop", "color": "c7ca4a", "description": "Specific to desktop" }, { "name": "Build ◦ Linux", "color": "c7ca4a", "description": "Specific to Linux" }, { "name": "Build ◦ MacOS", "color": "c7ca4a", "description": "Specific to MacOS" }, { "name": "Build ◦ Mobile", "color": "c7ca4a", "description": "Specific to mobile" }, { "name": "Build ◦ Web", "color": "c7ca4a", "description": "Specific to web" }, { "name": "Build ◦ Windows", "color": "c7ca4a", "description": "Specific to Windows" }, { "name": "› API", "color": "F99B50", "description": "Plugin API, CLI, browser JS API" }, { "name": "› Auto-type", "color": "9141E0", "description": "Auto-type functionality in desktop apps" }, { "name": "› Browser", "color": "9141E0", "description": "Browser plugins and passing data to <=> from app" }, { "name": "› Customization", "color": "E3F0FC", "description": "Customizations: plugins, themes, configs" }, { "name": "› Design", "color": "FA70DE", "description": "Design related queries" }, { "name": "› Dist", "color": "FA70DE", "description": "Installers and other forms of software distribution" }, { "name": "› Enterprise", "color": "11447a", "description": "Issues about collaboration, administration, and so on" }, { "name": "› Hardware", "color": "5a7503", "description": "YubiKey, other tokens, biometrics" }, { "name": "› Import/Export", "color": "F5FFCC", "description": "Import from and export to different file formats" }, { "name": "› Improvement", "color": "185c98", "description": "Enhance an existing feature" }, { "name": "› Performance", "color": "006b75", "description": "Web and desktop performance issues" }, { "name": "› Plugin Request", "color": "FCE9CA", "description": "Requested changes should be implemented as a plugin" }, { "name": "› Security", "color": "F75D39", "description": "Security issues" }, { "name": "› Self-Hosting", "color": "fad8c7", "description": "Self-hosting installations and configs" }, { "name": "› Storage", "color": "5319e7", "description": "Storage providers: Dropbox, Google, WebDAV, etc." }, { "name": "› Updater", "color": "1BADDE", "description": "Auto-updater issues" }, { "name": "› UX", "color": "1BADDE", "description": "UX and usability" }, { "name": "› Website", "color": "fef2c0", "description": "Website related issues" }, { "name": "⚠ Urgent", "color": "a8740e", "description": "Requires urgent attention" }, { "name": "⚠ Announcement", "color": "DB4712", "description": "Announcements" }, { "name": "📰 Progress Report", "color": "392297", "description": "Development updates" }, { "name": "📦 Release", "color": "277542", "description": "Release announcements" }, { "name": "✔️ Poll", "color": "972255", "description": "Community polls" }, { "name": "❔ Question", "color": "FFFFFF", "description": "All questions" } ] # # # jobs # # jobs: cleanup: # runs-on: ubuntu-latest runs-on: apollo-x64 timeout-minutes: 20 permissions: write-all steps: # # # Cleanup › Set Env Variables # # - name: >- 🕛 Get Timestamp id: task_cleanup_set_timestamp run: | echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV # # # Release › Github › Checkout › Arm64 # # - name: >- ✅ Checkout id: task_cleanup_gh_checkout uses: actions/checkout@v4 with: fetch-depth: 0 # # # Cleanup › Start # # - name: >- ⚙️ Deployments › Clean id: task_cleanup_start uses: Aetherinox/delete-deploy-env-action@v3 with: token: ${{ secrets.SELF_TOKEN_CL }} environment: '${{ env.DEPLOYMENT_ENV }}' onlyRemoveDeployments: true delay: "${{ env.DEPLOYMENT_DELAY }}" # # # Cleanup › Get Weekly Commits # # - name: >- 🕛 Get Weekly Commit List id: task_cleanup_set_weekly_commit_list run: | echo 'WEEKLY_COMMITS<> $GITHUB_ENV git log --format="[\`%h\`](${{ github.server_url }}/${{ github.repository }}/commit/%H) %s - %an" --since=7.days >> $GITHUB_ENV echo 'EOF' >> $GITHUB_ENV # # # Cleanup › Notify Github › Success # # - name: >- 🔔 Send Discord Webhook Message (Success) id: task_cleanup_notify_discord_success uses: tsickert/discord-webhook@v7.0.0 if: success() with: username: 'Io' avatar-url: 'https://i.imgur.com/8BVDkla.jpg' webhook-url: ${{ secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKfLOWS }} embed-title: "⚙️ ${{ github.workflow_ref }}" embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg' embed-description: | ## 📦 ᲼Deployment Cleanup ᲼${{ job.status == 'success' && '✅' || '❌' }} A **successful** deployment cleanup was triggered on your repository. The history for this environment has been wiped and will no longer list previous deployments you've made. - Environment: `${{ env.DEPLOYMENT_ENV }}` - Cleanup Delay: `${{ env.DEPLOYMENT_DELAY }}` - Workflow: `${{ github.workflow }} (#${{github.run_number}})` - Runner: `${{ runner.name }}` - Triggered By: `${{ github.actor }}` - Status: `${{ job.status == 'success' && '✅ Successful' || '❌ Failed' }}` embed-color: ${{ job.status == 'success' && '5763719' || '15418782' }} embed-footer-text: "Completed at ${{ env.NOW }} UTC" embed-timestamp: "${{ env.NOW_LONG }}" embed-author-name: "${{ github.repository_owner }}" embed-author-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" embed-author-icon-url: "https://avatars.githubusercontent.com/u/200161462" # # # Cleanup › Notify Github › Failure # # - name: >- 🔔 Send Discord Webhook Message (Failure) id: task_cleanup_notify_discord_failure uses: tsickert/discord-webhook@v7.0.0 if: failure() with: username: 'Io' avatar-url: 'https://i.imgur.com/8BVDkla.jpg' webhook-url: ${{ secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKfLOWS }} embed-title: "⚙️ ${{ github.workflow_ref }}" embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg' embed-description: | ## 📦 ᲼Deployment Cleanup ᲼${{ job.status == 'success' && '✅' || '❌' }} A **failed** deployment cleanup was triggered on your repository. Since the action failed; no entries of your repo's deployment history have been removed. - Environment: `${{ env.DEPLOYMENT_ENV }}` - Cleanup Delay: `${{ env.DEPLOYMENT_DELAY }}` - Workflow: `${{ github.workflow }} (#${{github.run_number}})` - Runner: `${{ runner.name }}` - Triggered By: `${{ github.actor }}` - Status: `${{ job.status == 'success' && '✅ Successful' || '❌ Failed' }}` embed-color: ${{ job.status == 'success' && '5763719' || '15418782' }} embed-footer-text: "Completed at ${{ env.NOW }} UTC" embed-timestamp: "${{ env.NOW_LONG }}" embed-author-name: "${{ github.repository_owner }}" embed-author-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" embed-author-icon-url: "https://avatars.githubusercontent.com/u/200161462"