From d12e61bc96601fa37b1bb08ee127144c4ff3255a Mon Sep 17 00:00:00 2001
From: Okinea Dev <hi@okinea.dev>
Date: Tue, 4 Feb 2025 08:53:41 +0200
Subject: [PATCH] refactor(ci): refactor GitHub Actions for better readablility

---
 .github/workflows/format.yml  | 14 +++++---
 .github/workflows/release.yml | 14 ++++----
 .github/workflows/test.yml    | 66 +++++++++++++++++------------------
 action.yml                    | 15 ++++----
 4 files changed, 58 insertions(+), 51 deletions(-)

diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
index 63a6e6f..e624984 100644
--- a/.github/workflows/format.yml
+++ b/.github/workflows/format.yml
@@ -14,17 +14,21 @@ jobs:
   format:
     runs-on: ubuntu-latest
     steps:
-      - name: Checkout
+      - name: ๐Ÿ“ฅ Checkout
         uses: actions/checkout@v4
-      - name: Setup Node
+
+      - name: ๐Ÿ› ๏ธ Setup Node
         uses: actions/setup-node@v4
         with:
           node-version: 20.x
-      - name: Install Dependencies
+
+      - name: ๐Ÿ“ฆ Install Dependencies
         run: npm install
-      - name: Format
+
+      - name: ๐Ÿงน Format
         run: |
           npm run format
           npm run build
-      - name: Commit
+
+      - name: ๐Ÿ’พ Commit
         uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9e00815..2fa926e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,25 +1,27 @@
-name: Release new action version
+name: ๐Ÿš€ Release new action version
 
 on:
   release:
     types: [released]
+
   workflow_dispatch:
     inputs:
       TAG_NAME:
-        description: 'Tag name that the major tag will point to'
+        description: Tag name that the major tag will point to
         required: true
 
-env:
-  TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
+permissions:
+  contents: write
 
 jobs:
   update_tag:
     runs-on: ubuntu-latest
-    permissions:
-      contents: write
+
     steps:
       - uses: actions/checkout@v4
 
       - uses: actions/publish-action@v0.3.0
+        env:
+          TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
         with:
           source-tag: ${{ env.TAG_NAME }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 227d551..ffdc36a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,4 +1,4 @@
-name: Test
+name: ๐Ÿงช Test
 
 on:
   workflow_dispatch:
@@ -15,21 +15,11 @@ jobs:
     runs-on: ubuntu-latest
     permissions: write-all
     steps:
-      - name: Checkout
+      - name: ๐Ÿ“ฅ Checkout
         uses: actions/checkout@v4
 
-      - name: Install github cli
-        run: |
-          (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
-          && sudo mkdir -p -m 755 /etc/apt/keyrings \
-          && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
-          && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
-          && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
-          && sudo apt update \
-          && sudo apt install gh -y
-
-      - run: |
-          gh cache delete --all || true
+      - name: ๐Ÿ—‘๏ธ Remove cache
+        run: gh cache delete --all || true
         env:
           GH_TOKEN: ${{ github.token }}
 
@@ -37,6 +27,7 @@ jobs:
     runs-on: ${{ matrix.os }}
     continue-on-error: true
     needs: [remove-cache]
+
     strategy:
       matrix:
         os:
@@ -54,17 +45,18 @@ jobs:
           # Disable <sha> support for now. This is because Github Artifacts
           # expire after 90 days, and we don't have another source of truth yet.
           # - "822a00c4d508b54f650933a73ca5f4a3af9a7983" # 1.0.0 commit
+
     steps:
-      - name: Checkout
+      - name: ๐Ÿ“ฅ Checkout
         uses: actions/checkout@v4
 
-      - name: Setup Bun
+      - name: ๐Ÿ› ๏ธ Setup Bun
         uses: ./
         id: setup_bun
         with:
           bun-version: ${{ matrix.bun-version }}
 
-      - name: Run Bun
+      - name: โ–ถ๏ธ Run Bun
         id: run_bun
         run: |
           bun --version
@@ -80,52 +72,56 @@ jobs:
           - ubuntu-latest
           - macos-latest
           - windows-latest
+
         file:
           - name: package.json (bun@1.1.0)
             file: package.json
             run: |
               echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > package.json
+
           - name: /foo/package.json (bun@1.1.0)
             file: /foo/package.json
             run: |
               echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > /foo/package.json
+
           - name: package.json (yarn@bun@1.1.0)
             file: package.json
             run: |
               echo "$(jq '. += {"packageManager": "yarn@bun@1.1.0"}' package.json)" > package.json
+
           - name: .tool-versions (bun 1.1.0)
             file: .tool-versions
-            run: |
-              echo "bun 1.1.0" > .tool-versions
+            run: echo "bun 1.1.0" > .tool-versions
+
           - name: .tool-versions (bun1.1.0)
             file: .tool-versions
-            run: |
-              echo "bun1.1.0" > .tool-versions
+            run: echo "bun1.1.0" > .tool-versions
+
           - name: .tool-versions (bun  1.1.0)
             file: .tool-versions
-            run: |
-              echo "bun  1.1.0" > .tool-versions
+            run: echo "bun 1.1.0" > .tool-versions
+
           - name: .bumrc (1.1.0)
             file: .bumrc
-            run: |
-              echo "1.1.0" > .bumrc
+            run: echo "1.1.0" > .bumrc
+
           - name: .bun-version (1.1.0)
             file: .bun-version
-            run: |
-              echo "1.1.0" > .bun-version
+            run: echo "1.1.0" > .bun-version
+
     steps:
-      - name: Checkout
+      - name: ๐Ÿ“ฅ Checkout
         uses: actions/checkout@v4
 
-      - name: Setup file
+      - name: ๐Ÿ“„ Setup file
         run: ${{ matrix.file.run }}
 
-      - name: Setup Bun
+      - name: ๐Ÿ› ๏ธ Setup Bun
         uses: ./
         with:
           bun-version-file: ${{ matrix.file.file }}
 
-      - name: Compare versions
+      - name: โš–๏ธ Compare versions
         uses: ./.github/actions/compare-bun-version
         with:
           bun-version: "1.1.0"
@@ -135,23 +131,25 @@ jobs:
     runs-on: ${{ matrix.os }}
     continue-on-error: true
     needs: [remove-cache]
+
     strategy:
       matrix:
         os:
           - ubuntu-latest
           - macos-latest
           - windows-latest
+
     steps:
-      - name: Checkout
+      - name: ๐Ÿ“ฅ Checkout
         uses: actions/checkout@v4
 
-      - name: Setup Bun
+      - name: ๐Ÿ› ๏ธ Setup Bun
         uses: ./
         id: setup_bun
         with:
           bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-${{runner.os == 'macOS' && 'darwin' || runner.os}}-${{ runner.arch == 'X64' && 'x64' || 'aarch64' }}.zip"
 
-      - name: Run Bun
+      - name: โ–ถ๏ธ Run Bun
         id: run_bun
         run: |
           bun --version
diff --git a/action.yml b/action.yml
index 5c1d85e..813706f 100644
--- a/action.yml
+++ b/action.yml
@@ -1,31 +1,34 @@
 name: Setup Bun
 description: Download, install, and setup Bun to your path.
 author: robobun
+
 branding:
   icon: play-circle
   color: white
+
 inputs:
   bun-version:
-    description: 'The version of Bun to install. (e.g. "latest", "canary", "1.0.0", "1.0.x", <sha>)'
+    description: The version of Bun to install. (e.g. "latest", "canary", "1.0.0", "1.0.x", <sha>)
     required: false
   bun-version-file:
-    description: 'The version of Bun to install from file. (e.g. "package.json", ".bun-version", ".tool-versions")'
+    description: The version of Bun to install from file. (e.g. "package.json", ".bun-version", ".tool-versions")
     default: null
     required: false
   bun-download-url:
-    description: "Override the URL to download Bun from. This skips version resolution and verifying AVX2 support."
+    description: Override the URL to download Bun from. This skips version resolution and verifying AVX2 support.
     required: false
   registry-url:
     required: false
-    description: "The URL of the package registry to use for installing Bun. Set the $BUN_AUTH_TOKEN environment variable to authenticate with the registry."
+    description: The URL of the package registry to use for installing Bun. Set the $BUN_AUTH_TOKEN environment variable to authenticate with the registry.
   scope:
     required: false
-    description: "The scope for authenticating with the package registry."
+    description: The scope for authenticating with the package registry.
   no-cache:
     required: false
     type: boolean
     default: false
-    description: "Disable caching of bun executable."
+    description: Disable caching of bun executable.
+
 outputs:
   bun-version:
     description: The version of Bun that was installed.