From 934beac1182814ec785baab2a84e886f5f2859b2 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 27 Oct 2023 16:57:21 +0900 Subject: [PATCH] Select the destination for the latest date by whether inplace mode --- .github/workflows/bundled_gems.yml | 2 +- tool/update-bundled_gems.rb | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bundled_gems.yml b/.github/workflows/bundled_gems.yml index 2fb3931423..d852fa4b32 100644 --- a/.github/workflows/bundled_gems.yml +++ b/.github/workflows/bundled_gems.yml @@ -58,7 +58,7 @@ jobs: - 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: | diff --git a/tool/update-bundled_gems.rb b/tool/update-bundled_gems.rb index 6b40595960..2f088804ef 100755 --- a/tool/update-bundled_gems.rb +++ b/tool/update-bundled_gems.rb @@ -2,13 +2,10 @@ BEGIN { require 'rubygems' date = nil - if ENV.key?('GITHUB_OUTPUT') - output = File.open(ENV['GITHUB_OUTPUT'], 'w') - else - output = STDERR - end } END { + # STDOUT is not usable in inplace edit mode + output = $-i ? STDOUT : STDERR output.print date.strftime("latest_date=%F") if date } unless /^[^#]/ !~ (gem = $F[0])