Merge pull request #18 from jongwooo/chore/replace-deprecated-command-with-environment-file
Replace deprecated command with environment file
This commit is contained in:
@@ -14,7 +14,7 @@ jobs:
|
||||
unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ env.ruby_version }}
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ env.ruby_version }}
|
||||
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
repo: context.repo.repo,
|
||||
labels: ['actions-importer-running']
|
||||
})
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7.1
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
path=$(ls output/log/*.log | head -1)
|
||||
filename=$(basename "$path")
|
||||
echo "LOG_FILE_PATH=$path" >> $GITHUB_ENV
|
||||
echo "::set-output name=filename::$filename"
|
||||
echo "filename=$filename" >> $GITHUB_OUTPUT
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
@@ -201,7 +201,7 @@ jobs:
|
||||
run: |
|
||||
pullRequest=$(grep "${{ env.pullRequestPattern }}" ${{ needs.execute-actions-importer.outputs.log-filename }} | sed -rn "s/^.*${{ env.pullRequestPattern }}'(.+)'.*$/\1/p")
|
||||
echo $pullRequest
|
||||
echo ::set-output name=output::$pullRequest
|
||||
echo "output=$pullRequest" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
pullRequestPattern: "Pull request: "
|
||||
- uses: actions/github-script@v6
|
||||
|
||||
@@ -4,6 +4,8 @@ module OutputWriter
|
||||
def set_output(name, value)
|
||||
return if value.nil?
|
||||
|
||||
puts "::set-output name=#{name}::#{value}"
|
||||
File.open(ENV["GITHUB_OUTPUT"], "a") do |f|
|
||||
f.puts "#{name}=#{value}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,15 +12,16 @@ RSpec.describe OutputWriter do
|
||||
describe "#set_output" do
|
||||
let(:name) { "var_name" }
|
||||
let(:value) { "var_value" }
|
||||
let(:output) { "#{name}=#{value}" }
|
||||
|
||||
subject { test_class.set_output(name, value) }
|
||||
|
||||
it { expect { subject }.to output(/::set-output name=#{name}::#{value}/).to_stdout }
|
||||
it { expect { subject }.to change { File.readlines(ENV["GITHUB_OUTPUT"], chomp: true).last }.to(/#{output}/) }
|
||||
|
||||
context "when value is nil" do
|
||||
let(:value) { nil }
|
||||
|
||||
it { expect { subject }.not_to output(/::set-output name=#{name}::#{value}/).to_stdout }
|
||||
it { expect { subject }.not_to change { File.read(ENV["GITHUB_OUTPUT"], chomp: true).last } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -104,6 +104,6 @@ RSpec.describe Command do
|
||||
COMMENT
|
||||
end
|
||||
|
||||
it { expect { subject }.to output(/::set-output name=command::audit/).to_stdout }
|
||||
it { expect { subject }.to change { File.readlines(ENV["GITHUB_OUTPUT"], chomp: true).last }.to("command=audit") }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,6 +52,12 @@ RSpec.describe Provider do
|
||||
|
||||
it { expect { subject }.not_to raise_error }
|
||||
end
|
||||
|
||||
context "when a provider is a quoted string" do
|
||||
let(:labels) { "[ \"jenkins\" ]" }
|
||||
|
||||
it { expect { subject }.not_to raise_error }
|
||||
end
|
||||
end
|
||||
|
||||
describe "#cli_command" do
|
||||
@@ -92,6 +98,6 @@ RSpec.describe Provider do
|
||||
LABELS
|
||||
end
|
||||
|
||||
it { expect { subject }.to output(/::set-output name=provider::azure-devops/).to_stdout }
|
||||
it { expect { subject }.to change { File.readlines(ENV["GITHUB_OUTPUT"], chomp: true).last }.to("provider=azure-devops") }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
require "bundler/setup"
|
||||
require "factory_bot"
|
||||
require "faker"
|
||||
require "fileutils"
|
||||
|
||||
require_relative "./../cli"
|
||||
|
||||
@@ -25,5 +26,12 @@ RSpec.configure do |config|
|
||||
|
||||
config.before(:suite) do
|
||||
FactoryBot.find_definitions
|
||||
Dir.mkdir("tmp") unless Dir.exist?("tmp")
|
||||
FileUtils.touch "tmp/test.txt"
|
||||
ENV["GITHUB_OUTPUT"] = "tmp/test.txt"
|
||||
end
|
||||
|
||||
config.after(:suite) do
|
||||
File.delete("tmp/test.txt")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user