diff --git a/.github/workflows/dependabot-sync.yml b/.github/workflows/dependabot-sync.yml index 349a63a908a..5bd33c9397b 100644 --- a/.github/workflows/dependabot-sync.yml +++ b/.github/workflows/dependabot-sync.yml @@ -1,20 +1,17 @@ name: Sync Dependabot Bump on: pull_request: - types: [opened, reopened, edited] -permissions: - pull-requests: write + types: [opened, synchronize] +permissions: + contents: write jobs: sync: + if: ${{ github.actor == 'dependabot[bot]' }} name: Sync dependency files runs-on: ubuntu-latest - strategy: - matrix: - node-version: [16.x] - steps: - name: Checkout Repository uses: actions/checkout@v3 @@ -28,8 +25,9 @@ jobs: run: node ./scripts/sync-dependencies.mjs ${{ github.head_ref }} - name: Commit Changes run: | + git add . git status git config user.name github-actions git config user.email github-actions@github.com - git commit -am "[dependabot skip] bumped ${{ github.head_ref }} changes in config/dependencies.yaml" + git commit -m "[dependabot skip] bumped ${{ github.head_ref }} changes in config/dependencies.yaml" git push diff --git a/scripts/sync-dependencies.mjs b/scripts/sync-dependencies.mjs index 358bcbf9fe3..38b06d12838 100644 --- a/scripts/sync-dependencies.mjs +++ b/scripts/sync-dependencies.mjs @@ -26,7 +26,7 @@ const dependency = branchName // because this is from dependabot, // and because we want all our versions synced // we simply find and replace the version wherever it is specified -const rgx = new RegExp(`(?<='${dependency}':\\W{0,2}\\w*\\W?')\\d+\\.\\d+\\.\\d+(?=')`, 'g') +const rgx = new RegExp(`(?<='@?${dependency}':\\W{0,2}\\w*\\W?')\\d+\\.\\d+\\.\\d+(?=')`, 'g') const newDepsRaw = oldDepsRaw.replace(rgx, dependencyVersion) console.log(`Updating ${dependency} version to ${dependencyVersion} in config/dependencies.yaml`)