Skip to content

Commit 095a270

Browse files
committed
Auto-publish when web-features or bcd change
1 parent c83167f commit 095a270

File tree

4 files changed

+83
-10
lines changed

4 files changed

+83
-10
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,16 @@ updates:
88
- package-ecosystem: "npm" # See documentation for possible values
99
directory: "/" # Location of package manifests
1010
schedule:
11-
interval: "daily"
11+
cron: "0 12 * * *" # Every day at midnight UTC
12+
allow:
13+
- dependency-name: "@mdn/browser-compat-data"
14+
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
15+
- dependency-name: "web-features"
16+
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
17+
commit-message:
18+
prefix: "chore"
19+
include: "scope"
20+
open-pull-requests-limit: 5
21+
# Automerge minor/patch updates for these dependencies
22+
automerge: true
23+
automerge-type: "pr"

.github/workflows/refresh_downstream.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ jobs:
4747
git commit -m 'Updating downstream-browsers'
4848
git push origin main
4949
50-
- name: Tag release for publishing
51-
if: steps.push-to-main.outcome == 'success'
52-
id: tag-release
53-
run: |
54-
npm version patch -m "Patch to %s because downstream-browsers.json changed"
55-
git push && git push --tags
50+
# - name: Tag release for publishing
51+
# if: steps.push-to-main.outcome == 'success'
52+
# id: tag-release
53+
# run: |
54+
# npm version patch -m "Patch to %s because downstream-browsers.json changed"
55+
# git push && git push --tags

.github/workflows/refresh_static.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
- name: Install environment
2626
run: npm ci
2727

28-
- name: Install environment
29-
run: npm i web-features@latest @mdn/browser-compat-data@latest
30-
3128
- name: Run refresh-downstream.ts
3229
id: refresh-downstream-script
3330
run: |
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Tag on Dependency or Data Update
2+
3+
on:
4+
schedule:
5+
- cron: '0 15 * * *' # Every day at 15:00 UTC
6+
7+
jobs:
8+
tag-if-updated:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0 # fetch all history for git log
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
21+
- name: Check for changes to downstream-browser.json in last 24h
22+
id: check_downstream
23+
run: |
24+
if git log --since="24 hours ago" --pretty=format: --name-only | grep -q '^src/data/downstream-browser.json$'; then
25+
echo "changed=true" >> $GITHUB_OUTPUT
26+
else
27+
echo "changed=false" >> $GITHUB_OUTPUT
28+
fi
29+
30+
- name: Check for merged Dependabot PRs in last 24h
31+
id: check_dependabot
32+
env:
33+
GH_TOKEN: ${{ github.token }}
34+
run: |
35+
merged=$(gh pr list --state merged --search "is:pr merged:>=$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ) author:app/dependabot" --json number --jq 'length')
36+
if [ "$merged" -gt 0 ]; then
37+
echo "merged=true" >> $GITHUB_OUTPUT
38+
else
39+
echo "merged=false" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: Bump version and push tag if needed
43+
if: steps.check_downstream.outputs.changed == 'true' && steps.check_dependabot.outputs.merged == 'true'
44+
run: |
45+
git config user.name "github-actions[bot]"
46+
git config user.email "github-actions[bot]@users.noreply.github.com"
47+
npm version patch -m "chore: bump version to %s because downstream and dependencies changed [skip ci]"
48+
git push origin main --follow-tags
49+
50+
- name: Bump version and push tag if needed
51+
if: steps.check_downstream.outputs.changed == 'true' && !steps.check_dependabot.outputs.merged == 'true'
52+
run: |
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
npm version patch -m "chore: bump version to %s because downstream changed [skip ci]"
56+
git push origin main --follow-tags
57+
58+
- name: Bump version and push tag if needed
59+
if: steps.check_dependabot.outputs.merged == 'true' && !steps.check_downstream.outputs.changed == 'true'
60+
run: |
61+
git config user.name "github-actions[bot]"
62+
git config user.email "github-actions[bot]@users.noreply.github.com"
63+
npm version patch -m "chore: bump version to %s because dependencies changed[skip ci]"
64+
git push origin main --follow-tags

0 commit comments

Comments
 (0)