Skip to content

Commit

Permalink
ci(workflows): add dependabot-dedupe
Browse files Browse the repository at this point in the history
- dependabot/dependabot-core#5830
- partially replaces `dependabot-auto`

Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Oct 22, 2023
1 parent d2cd2d5 commit 8170104
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 90 deletions.
1 change: 1 addition & 0 deletions .dictionary.txt
Expand Up @@ -40,6 +40,7 @@ sortbrk
sortcmt
sortgrp
stringafiable
tohgarashi
tryit
tscu
unstub
Expand Down
4 changes: 1 addition & 3 deletions .github/dependabot.yml
Expand Up @@ -8,7 +8,7 @@
version: 2
registries:
github:
token: ${{ secrets.PAT_BOT }}
token: ${{ secrets.PAT_REPO }}
type: npm-registry
url: https://npm.pkg.github.com
updates:
Expand All @@ -22,7 +22,6 @@ updates:
- type:ci
reviewers:
- flex-development/dependabot-review
- flexdevelopment
schedule:
interval: daily
- package-ecosystem: npm
Expand Down Expand Up @@ -65,6 +64,5 @@ updates:
- github
reviewers:
- flex-development/dependabot-review
- flexdevelopment
schedule:
interval: daily
2 changes: 1 addition & 1 deletion .github/infrastructure.yml
Expand Up @@ -48,7 +48,7 @@ branches:
- context: codecov/project/providers
app_id: 254
- context: commitlint
- context: dependabot-auto
- context: dependabot-dedupe
- context: format
- context: gitguardian
- context: lint
Expand Down
82 changes: 0 additions & 82 deletions .github/workflows/dependabot-auto.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/dependabot-dedupe.yml
@@ -0,0 +1,77 @@
# Dependabot Dedupe
#
# Deduplicate dependencies for @dependabot.
#
# Note: This workflow can be removed once dependabot supports some type of automatic deduplication.
# See https://github.com/dependabot/dependabot-core/issues/5830 for details.
#
# References:
#
# - https://docs.github.com/actions/learn-github-actions/contexts
# - https://docs.github.com/actions/learn-github-actions/expressions
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
# - https://docs.github.com/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
# - https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
# - https://github.com/actions/checkout
# - https://github.com/actions/create-github-app-token
# - https://github.com/actions/setup-node
# - https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#yarn2-configuration
# - https://github.com/hmarr/debug-action
# - https://github.com/tohgarashi/verified-commit

---
name: dependabot-dedupe
on:
push:
branches:
- dependabot/npm_and_yarn/**
paths:
- package.json
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
dependabot-dedupe:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- id: debug
name: Print environment variables and event payload
uses: hmarr/debug-action@v2.1.0
- id: bot-token
name: Get bot token
uses: actions/create-github-app-token@v1.5.0
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- id: checkout
name: Checkout ${{ github.ref_name }}
uses: actions/checkout@v4.1.1
with:
persist-credentials: false
ref: ${{ github.ref }}
token: ${{ steps.bot-token.outputs.token }}
- id: node
name: Setup Node.js
uses: actions/setup-node@v3.8.1
with:
cache: yarn
cache-dependency-path: yarn.lock
node-version-file: .nvmrc
- id: dedupe
name: Deduplicate dependencies
env:
GITHUB_TOKEN: ${{ steps.bot-token.outputs.token }}
YARN_ENABLE_GLOBAL_CACHE: true
YARN_ENABLE_IMMUTABLE_INSTALLS: false
YARN_ENABLE_SCRIPTS: false
run: yarn dedupe --mode=update-lockfile
- id: commit
name: Commit and push yarn.lock
uses: tohgarashi/verified-commit@v2.1.0
env:
GH_TOKEN: ${{ steps.bot-token.outputs.token }}
with:
commit-message: 'build(yarn): [dependabot skip] deduplicate dependencies for @dependabot'
detect-changed: true
ref: ${{ github.ref }}
2 changes: 1 addition & 1 deletion .npmrc
@@ -1,5 +1,5 @@
# https://docs.npmjs.com/cli/configuring-npm/npmrc

@flex-development:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${PAT_BOT}
//npm.pkg.github.com/:_authToken=${PAT_REPO}
//npm.pkg.github.com/:always-auth=true
2 changes: 1 addition & 1 deletion .yarnrc.yml
Expand Up @@ -27,7 +27,7 @@ nodeLinker: node-modules
npmScopes:
flex-development:
npmAlwaysAuth: true
npmAuthToken: ${GITHUB_TOKEN:-$PAT_BOT}
npmAuthToken: ${GITHUB_TOKEN:-$PAT_REPO}
npmRegistryServer: https://npm.pkg.github.com

patchFolder: ./patches
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Expand Up @@ -106,9 +106,8 @@ Follow the steps below to setup your local development environment:
| `CODECOV_TOKEN` |
| `GITHUB_TOKEN` |
| `HOMEBREW_BREWFILE` |
| `NODE_ENV` |
| `NODE_NO_WARNINGS` |
| `PAT_BOT` |
| `PAT_REPO` |
| `ZSH_DOTENV_FILE` |

#### GitHub Actions
Expand Down

0 comments on commit 8170104

Please sign in to comment.