Skip to content

Commit 6c15b77

Browse files
committed
Add CI workflow to raise gem update PRs
1 parent 352add5 commit 6c15b77

4 files changed

Lines changed: 86 additions & 8 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
3+
name: Update components
4+
5+
on:
6+
workflow_call: {}
7+
schedule:
8+
- cron: "0 0 * * *"
9+
10+
env:
11+
GIT_AUTHOR_NAME: OpenVoxProjectBot
12+
GIT_AUTHOR_EMAIL: 215568489+OpenVoxProjectBot@users.noreply.github.com
13+
GIT_COMMITTER_NAME: OpenVoxProjectBot
14+
GIT_COMMITTER_EMAIL: 215568489+OpenVoxProjectBot@users.noreply.github.com
15+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
16+
17+
jobs:
18+
update_gems:
19+
name: 'Update gem components'
20+
runs-on: ubuntu-24.04
21+
if: github.repository_owner == 'OpenVoxProject'
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v6
25+
- name: Setup Ruby
26+
uses: ruby/setup-ruby@v1
27+
with:
28+
bundler-cache: true
29+
- name: Add SSH key
30+
run: |
31+
mkdir -p ~/.ssh
32+
echo "${{ secrets.OPENVOXBOT_SSH_PRIVATE_KEY }}" > ~/.ssh/github_actions
33+
chmod 600 ~/.ssh/github_actions
34+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
35+
ssh-add ~/.ssh/github_actions
36+
- name: Setup git
37+
run: |
38+
git config --global user.email "$GIT_AUTHOR_EMAIL"
39+
git config --global user.name "$GIT_AUTHOR_NAME"
40+
git config --global gpg.format ssh
41+
git config --global user.signingkey ~/.ssh/github_actions
42+
git config --global commit.gpgsign true
43+
git config --global tag.gpgsign true
44+
- name: Display bundle environment
45+
run: bundle env
46+
- name: Check for gem updates
47+
run: vox:update_gems
48+
- name: Create pull Request
49+
uses: peter-evans/create-pull-request@v8
50+
with:
51+
commit-message: "Update Ruby components"
52+
branch: "component-update"
53+
delete-branch: true
54+
title: "Update Ruby components"
55+
labels: skip-changelog
56+
token: '${{ secrets.OPENVOXBOT_COMMIT_AND_PRS }}'
57+
assignees: '${{ github.triggering_actor }}'
58+
author: '${{ env.GIT_AUTHOR_NAME }} <${{ env.GIT_AUTHOR_EMAIL }}>'
59+
committer: '${{ env.GIT_COMMITTER_NAME }} <${{ env.GIT_COMMITTER_EMAIL }}>'
60+
body: |
61+
Automated gem update task

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,18 @@ Where:
5959
## Updating rubygem components
6060

6161
This repo includes a rake task that will use the RubyGems API to update all rubygem components, including adding any missing runtime dependencies.
62+
6263
```
6364
$ bundle exec rake vox:update_gems
6465
```
66+
67+
This is the all-in-one task, which will also commit your changes.
68+
However, there is also `vox:update_gems_wo_commit`, which does the same except committing changes.
69+
There's a CI workflow that runs daily + on demand.
70+
It raises a PR / updates an existing PR if the rake task finds any changes.
71+
6572
In each `rubygem-*.rb` file in `configs/components`, you will find a "magic" block near the top. For example:
73+
6674
```
6775
### Maintained by update_gems automation ###
6876
pkg.version '2.14.0'

configs/components/rubygem-openvox.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#####
88
component 'rubygem-openvox' do |pkg, _settings, _platform|
99
### Maintained by update_gems automation ###
10-
pkg.version '8.26.0'
11-
pkg.sha256sum '9521f56fee57d0f70675bda180bbfd4b36b86ce5f940fc2390a397323e1f747e'
10+
pkg.version '8.26.1'
11+
pkg.sha256sum '0946b24ecec93812b30b15952d6c6431bf90565518ce9d63b007c1fd3b44d14b'
1212
pkg.build_requires 'rubygem-base64'
1313
pkg.build_requires 'rubygem-concurrent-ruby'
1414
pkg.build_requires 'rubygem-deep_merge'

tasks/update_gems.rake

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,7 @@ def ensure_no_uncommitted_changes
483483
exit 1
484484
end
485485

486-
namespace :vox do
487-
desc 'Update rubygem components and print a summary of changes'
488-
task :update_gems do
486+
def check_and_summarize(commit=true)
489487
ensure_no_uncommitted_changes
490488

491489
progress_print('Updating components and creating missing ones')
@@ -505,8 +503,19 @@ namespace :vox do
505503

506504
puts summary
507505

508-
git_add
509-
git_commit(summary)
510-
git_summary
506+
if commit
507+
git_add
508+
git_commit(summary)
509+
git_summary
510+
end
511+
end
512+
namespace :vox do
513+
desc 'Update rubygem components, commit them and print a summary of changes'
514+
task :update_gems do
515+
check_and_summarize(commit=true)
516+
end
517+
desc 'Update rubygem components, commit them and print a summary of changes'
518+
task :update_gems_wo_commit do
519+
check_and_summarize(commit=false)
511520
end
512521
end

0 commit comments

Comments
 (0)