Skip to content

Commit

Permalink
Merge pull request #705 from adobe/mess-with-renovate
Browse files Browse the repository at this point in the history
chore(renovate): use nicer branch names for renovate
  • Loading branch information
trieloff authored Dec 18, 2024
2 parents e573152 + 834b760 commit f620c7c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 10 deletions.
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

0 comments on commit f620c7c

Please sign in to comment.