Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(renovate): use nicer branch names for renovate #705

Merged
merged 3 commits into from
Dec 18, 2024
Merged
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
35 changes: 35 additions & 0 deletions .github/workflows/update-importmaps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Update import maps
on:
pull_request:
branches:
- 'r_*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Install dependencies
run: npm install
- name: Update import maps
run: tools/imports.sh
- name: Commit changes
run: |
git add -A
git commit -m "chore(oversight): update import maps"
git push
- name: Update PR comment to include aem.live test URL
run: |
OLD_BODY=$(gh pr view --json body --jq ".body")
BRANCH_NAME=$(echo ${{ github.ref }} | sed 's|refs/heads/||')
NEW_BODY="$OLD_BODY\n\nTest at: https://$BRANCH_NAME--helix-website--adobe.aem.live/tools/oversight/explorer.html?domain=www.emigrationbrewing.com"
gh pr edit ${{ github.event.number }} --body "$NEW_BODY"
13 changes: 3 additions & 10 deletions .renovaterc.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
{
"enabled": true,
"baseBranches": ["main"],
"branchNameStrict": true,
"branchName": "r_{{{packageName}}}_{{version}}",
"packageRules": [
{
"matchDepNames": ["@adobe/rum-distiller"],
"labels": ["rum-distiller"],
"automerge": true,
"automerge": false,
"automergeType": "pr",
"requiredStatusChecks": null,
"fileMatch": [
"tools/oversight/explorer.html",
"tools/oversight/flow.html",
"tools/oversight/list.html",
"tools/oversight/package.json",
"tools/oversight/share.html",
"tools/oversight/single.html",
"tools/rum/explorer.html",
"tools/rum/package.json",
"package.json"
]
},
Expand Down
13 changes: 13 additions & 0 deletions tools/imports.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/bash

DEPENDENCY="@adobe/rum-distiller"
VERSION_FROM_PACKAGE_JSON=$(node -e "console.log(require('./package.json').devDependencies['@adobe/rum-distiller'])")

# find all import maps in the project, and replace the import named $1 with the value of $2

find ./tools/oversight -name "*.html" | while read file; do
echo "Processing $file upgrading $DEPENDENCY to $VERSION_FROM_PACKAGE_JSON"
# Use sed to replace the import map entry with the new version
sed -i.bak "s|\"@adobe/rum-distiller\": \"https://esm.sh/@adobe/rum-distiller@[0-9.]*\"|\"@adobe/rum-distiller\": \"https://esm.sh/@adobe/rum-distiller@$VERSION_FROM_PACKAGE_JSON\"|g" "$file"
rm "$file.bak"
done
Loading