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