From b2d8691e02a6775109b1f3230be3fddb43815139 Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Tue, 8 Aug 2023 12:50:51 -0400 Subject: [PATCH] chore: add `deduplicate-yarn` workflow (#6109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Logan McAnsh Co-authored-by: Michaël De Boey --- .github/workflows/deduplicate-yarn.yml | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/deduplicate-yarn.yml diff --git a/.github/workflows/deduplicate-yarn.yml b/.github/workflows/deduplicate-yarn.yml new file mode 100644 index 00000000000..3528fbb797a --- /dev/null +++ b/.github/workflows/deduplicate-yarn.yml @@ -0,0 +1,44 @@ +name: ⚙️ Deduplicate yarn.lock + +on: + push: + branches: + - dev + paths: + - ./yarn.lock + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + format: + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v3 + + - name: ⎔ Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + cache: "yarn" + + - name: ️️⚙️ Dedupe yarn.lock + run: npx yarn-deduplicate && rm -rf ./node_modules && yarn + + - name: 💪 Commit + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + git add . + if [ -z "$(git status --porcelain)" ]; then + echo "💿 no deduplication needed" + exit 0 + fi + git commit -m "chore: deduplicate `yarn.lock`" + git push + echo "💿 https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)"