Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# Product code
src/ @MetaMask/Web3Auth-Product
test/ @MetaMask/Web3Auth-Product
.changeset/ @MetaMask/Web3Auth-Product

# Most restrictive — last match wins
.github/CODEOWNERS @MetaMask/Web3Auth-Admins
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ updates:
cooldown:
default-days: 3
open-pull-requests-limit: 10
commit-message:
prefix: "chore(deps)"
prefix-development: "chore(deps-dev)"
- package-ecosystem: github-actions
directory: /
schedule:
Expand Down
68 changes: 67 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,76 @@ jobs:
- name: Run tests
run: npm run test

release-notes:
if: github.event_name == 'pull_request' && !startsWith(github.head_ref, 'changeset-release/')
runs-on: ubuntu-latest
permissions:
# contents: write pushes the automatic changeset created below.
contents: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24.22"
cache: "npm"

- name: Install npm 12
run: npm install --global npm@12.2.0

- name: Install dependencies
run: npm ci

- name: Check release notes
if: github.event_name == 'pull_request' && !startsWith(github.head_ref, 'changeset-release/')
env:
BASE_REF: ${{ github.base_ref }}
HEAD_REF: ${{ github.head_ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
GH_TOKEN: ${{ github.token }}
run: |
git fetch --no-tags origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}"
# Dependabot subjects only; --no-merges skips GitHub's pull/N/merge test commits.
subjects="$(git log "origin/${BASE_REF}..HEAD" --no-merges --format='%an %s' | sed -n 's/^dependabot\[bot\] //p')"

# devDependency-only bumps (chore(deps-dev):) never release.
if [[ "${HEAD_REF}" == dependabot/* ]] && [[ -n "${subjects}" ]] && ! grep -qv '^chore(deps-dev):' <<<"${subjects}"; then
exit 0
fi

if npm exec -- changeset status --since="origin/${BASE_REF}"; then
exit 0
fi

# Production bumps (chore(deps):) release as a patch, so add the changeset
# Dependabot cannot write. Contents-API commits are GitHub-signed and
# fast-forward only, so branch protection still holds.
if [[ "${HEAD_REF}" != dependabot/npm_and_yarn/* ]] || [[ -z "${subjects}" ]] || grep -qv '^chore(deps):' <<<"${subjects}"; then
echo "::error::Missing changeset. Run 'npm exec -- changeset' to add one."
exit 1
fi

changeset_path=".changeset/dependabot-${PR_NUMBER}.md"
printf -- '---\n"%s": patch\n---\n\n%s (#%s)\n' \
"$(node -p "require('./package.json').name")" "${PR_TITLE}" "${PR_NUMBER}" > "${changeset_path}"
# changeset status --since only counts changesets that appear in
# "git diff <diverged-commit>", which ignores untracked files.
git add "${changeset_path}"
npm exec -- changeset status --since="origin/${BASE_REF}"

encoded_path="${changeset_path//\//%2F}"
put_args=(
-f message="chore: add patch changeset for Dependabot PR #${PR_NUMBER}"
-f content="$(base64 -w0 "${changeset_path}")"
-f branch="${HEAD_REF}"
)
# The file already exists when a run is re-executed.
if file_sha="$(gh api "repos/${GITHUB_REPOSITORY}/contents/${encoded_path}" --method GET -f ref="${HEAD_REF}" --jq '.sha' 2>/dev/null)"; then
put_args+=(-f sha="${file_sha}")
fi
gh api -X PUT "repos/${GITHUB_REPOSITORY}/contents/${encoded_path}" "${put_args[@]}"
echo "Created ${changeset_path} on ${HEAD_REF}"