diff --git a/.github/workflows/bundled_gems.yml b/.github/workflows/bundled_gems.yml index b44e5bbb5f..1827420154 100644 --- a/.github/workflows/bundled_gems.yml +++ b/.github/workflows/bundled_gems.yml @@ -51,8 +51,9 @@ jobs: curl -O -R -z ./$data https://stdgems.org/$data - name: Update bundled gems list + id: bundled_gems run: | - ruby -i~ tool/update-bundled_gems.rb gems/bundled_gems + ruby -i~ tool/update-bundled_gems.rb gems/bundled_gems > $GITHUB_OUTPUT - name: Maintain updated gems list in NEWS run: | @@ -99,14 +100,15 @@ jobs: - name: Commit run: | git pull --ff-only origin ${GITHUB_REF#refs/heads/} - message="Update bundled gems list at " + message="Update bundled gems list" if [ -z "${gem}" ]; then - git commit --message="${message}${GITHUB_SHA:0:30} [ci skip]" + git commit --message="${message} at ${GITHUB_SHA:0:30} [ci skip]" else - git commit --message="${message}${TODAY}" + git commit --message="${message} as of ${TODAY}" fi git push origin ${GITHUB_REF#refs/heads/} env: + TODAY: ${{ steps.bundled_gems.outputs.latest_date || env.TODAY }} EMAIL: svn-admin@ruby-lang.org GIT_AUTHOR_NAME: git GIT_COMMITTER_NAME: git diff --git a/tool/update-bundled_gems.rb b/tool/update-bundled_gems.rb index 688ca34086..fbba589cd6 100755 --- a/tool/update-bundled_gems.rb +++ b/tool/update-bundled_gems.rb @@ -1,6 +1,11 @@ #!ruby -pla BEGIN { require 'rubygems' + date = nil + stdout = $> +} +END { + stdout.print date.strftime("latest_date=%F") if date } unless /^[^#]/ !~ (gem = $F[0]) (gem, src), = Gem::SpecFetcher.fetcher.detect(:latest) {|s| @@ -13,6 +18,7 @@ unless /^[^#]/ !~ (gem = $F[0]) else uri = $F[2] end + date = gem.date if !date or gem.date && gem.date > date if $F[3] if $F[3].include?($F[1]) $F[3][$F[1]] = gem.version.to_s