Deduplicate dependencies on master #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Deduplicate dependencies' | |
on: | |
workflow_dispatch: | |
inputs: | |
push_directly: | |
description: 'push directly to the branch' | |
type: boolean | |
default: false | |
run-name: Deduplicate dependencies on ${{ github.ref_name }} | |
jobs: | |
dedupe_deps: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
shell: bash | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Dedupe deps | |
run: yarn dedupe | |
- name: Set Git credentials | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Create pull request with deduped deps | |
if: ${{ inputs.push_directly != true }} | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} | |
title: 'chore: Deduplicate dependencies on ${{ github.ref_name }}' | |
branch: ${{ github.ref_name }}-dedupe-deps | |
commit-message: 'chore: deduplicate dependencies' | |
body: Automated dependencies deduplication | |
delete-branch: true | |
- name: Commit files | |
if: ${{ inputs.push_directly == true }} | |
run: | | |
git commit -a -m "chore: deduplicate dependencies" | |
- name: Push changes to the branch directly | |
if: ${{ inputs.push_directly == true }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} | |
branch: ${{ github.ref_name }} |