-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruby--daily-dependencies-update.yml
More file actions
98 lines (87 loc) · 3.37 KB
/
Copy pathruby--daily-dependencies-update.yml
File metadata and controls
98 lines (87 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# This workflow updates gem dependencies every day and opens a pull request
# when any dependency changes are detected.
name: Ruby - Daily Dependencies Update
on:
schedule:
# 0:00 JST every day
- cron: "0 15 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update_gem_dependencies:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-ruby
with:
job-name: update_gem_dependencies
- name: Update Gem Dependencies
working-directory: ./ruby
env:
BUNDLE_FROZEN: "false"
run: |
gem update --system
gem install bundler
bundle update --bundler
bundle update --all
- name: Mirror Updated Versions to Gemfile
working-directory: ./ruby
env:
BUNDLE_FROZEN: "false"
run: |
ruby <<'RUBY'
versions = File.read('Gemfile.lock').scan(/^ (\S+) \((\d+(?:\.\d+)*)\)$/).to_h
gemfile = File.read('Gemfile').gsub(/^(\s*gem '([^']+)', )'~> [^']+'/) do
versions[$2] ? "#{$1}'~> #{versions[$2]}'" : $~[0]
end
File.write('Gemfile', gemfile)
RUBY
bundle lock --add-checksums
- name: Generate Pull Request Description
env:
BODY_PATH: ${{ runner.temp }}/pr_body.md
run: |
{
cat <<'OVERVIEW'
## 1. Overview
This pull request was created automatically by the Ruby - Daily Dependencies Update workflow.
It upgrades RubyGems and Bundler, updates every gem to the latest version allowed by the Gemfile, mirrors the updated versions to the Gemfile, and re-locks Gemfile.lock so its DEPENDENCIES section stays in sync with the Gemfile:
~~~console
gem update --system
gem install bundler
bundle update --bundler
bundle update --all
~~~
## 2. Key Changes & Differences
OVERVIEW
echo
bash .github/scripts/dependency_report.sh gem ruby/Gemfile.lock ruby/Gemfile Gems
cat <<SUMMARY
## 3. Summary
All gem dependencies in ruby/Gemfile and ruby/Gemfile.lock are now up to date.
Please make sure that all CI workflows pass before merging this pull request.
## 4. References
- [Ruby - Daily Dependencies Update workflow run](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)
- [bundle update documentation](https://bundler.io/man/bundle-update.1.html)
- [RubyGems](https://rubygems.org/)
SUMMARY
} > "$BODY_PATH"
- name: Compute Timestamp
run: echo "TIMESTAMP=$(TZ=Asia/Tokyo date '+%Y-%m-%d %H:%M:%S JST')" >> "$GITHUB_ENV"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
sign-commits: true
branch: hayat01sh1da/daily/ruby/update-rubygems-dependencies
delete-branch: true
add-paths: |
ruby/Gemfile
ruby/Gemfile.lock
commit-message: "[Daily][Ruby] Update RubyGems dependencies at ${{ env.TIMESTAMP }}"
title: "[Daily][Ruby] Update RubyGems Dependencies"
body-path: ${{ runner.temp }}/pr_body.md
reviewers: hayat01sh1da
assignees: hayat01sh1da