From 3b1b8b15c1b1adcf379e2805231ffbcbc5c1a40d Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Sat, 1 Jun 2024 12:05:18 +0200 Subject: [PATCH] Clone the entire history in the CI workflow This is necessary for the changelog generation to work correctly. Additionally this includes an improvement to sort the contributors alphabetically, if they have the same amount of contributions. --- .github/workflows/ci.yml | 9 ++++++--- webpack.config.js | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39699d9..235d2ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,12 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + # This forces the entire history to be cloned, which is necessary for + # the changelog generation to work correctly. + fetch-depth: 0 - name: Install Node - uses: actions/setup-node@v2.3.0 + uses: actions/setup-node@v4 with: node-version: 'lts/*' @@ -30,7 +33,7 @@ jobs: - name: Download binaryen if: github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master' - uses: robinraju/release-downloader@v1.7 + uses: robinraju/release-downloader@v1.10 with: repository: "WebAssembly/binaryen" latest: true @@ -107,7 +110,7 @@ jobs: - name: Deploy if: github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master' - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} publish_branch: gh-pages diff --git a/webpack.config.js b/webpack.config.js index 19e922c..2c1827a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -23,7 +23,7 @@ function parseChangelog() { if (changelogIndex === -1) { return {}; } - const dateIndex = commit.indexOf("Date: "); + const dateIndex = commit.indexOf(/^Date: /); if (dateIndex === -1) { return {}; } @@ -69,7 +69,10 @@ export default async (env, argv) => { } const contributorsList = Object.values(coreContributorsMap) - .sort((user1, user2) => user2.contributions - user1.contributions) + // Sort by contributions, but fallback to alphabetical order for the + // same amount of contributions + .sort((a, b) => a.login > b.login ? 1 : b.login > a.login ? -1 : 0) + .sort((a, b) => b.contributions - a.contributions) .map((user) => { return { id: user.id, name: user.login }; });