From ad688c24caa3a389c3dd7b73f629ef7188bf3790 Mon Sep 17 00:00:00 2001 From: Samir Anand Date: Wed, 18 Jan 2023 19:06:08 +0530 Subject: [PATCH 1/4] adding action for automation --- .github/workflows/action.yml | 32 +++++++++++++++ generator.sh | 1 + mmv1/Gemfile.lock | 78 ------------------------------------ 3 files changed, 33 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/action.yml create mode 100644 generator.sh delete mode 100644 mmv1/Gemfile.lock diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml new file mode 100644 index 000000000..821e217b2 --- /dev/null +++ b/.github/workflows/action.yml @@ -0,0 +1,32 @@ +name: Generate files and raise PR + +on: [push] + +jobs: + generate-files: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Execute code + run: | + # Run the code that generates the files + ruby code.rb + - name: Create new branch + uses: actions/create-branch@v1 + with: + repository: OWNER/DESTINATION-REPO + branch: feature-branch + - name: Upload files + uses: actions/upload-artifact@v1 + with: + name: files + path: path/to/generated/files + - name: Raise pull request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: feature-branch + title: "Move files to new directory" + message: "This pull request moves files to a new directory" + labels: "enhancement" diff --git a/generator.sh b/generator.sh new file mode 100644 index 000000000..e152499eb --- /dev/null +++ b/generator.sh @@ -0,0 +1 @@ +compiler.rb -e inspec -p products/kms -t Location -o build/inspec \ No newline at end of file diff --git a/mmv1/Gemfile.lock b/mmv1/Gemfile.lock deleted file mode 100644 index 3450bc664..000000000 --- a/mmv1/Gemfile.lock +++ /dev/null @@ -1,78 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - activesupport (5.2.4.3) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - ast (2.4.0) - binding_of_caller (0.8.0) - debug_inspector (>= 0.0.1) - concurrent-ruby (1.1.6) - debug_inspector (0.0.3) - diff-lcs (1.3) - faraday (0.15.4) - multipart-post (>= 1.2, < 3) - i18n (1.8.2) - concurrent-ruby (~> 1.0) - jaro_winkler (1.5.4) - metaclass (0.0.4) - minitest (5.14.1) - mocha (1.3.0) - metaclass (~> 0.0.1) - multipart-post (2.0.0) - octokit (4.13.0) - sawyer (~> 0.8.0, >= 0.5.3) - parallel (1.19.1) - parser (2.6.5.0) - ast (~> 2.4.0) - public_suffix (3.0.3) - rainbow (3.0.0) - rake (12.3.3) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - rubocop (0.77.0) - jaro_winkler (~> 1.5.1) - parallel (~> 1.10) - parser (>= 2.6) - rainbow (>= 2.2.2, < 4.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - ruby-progressbar (1.10.1) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) - thread_safe (0.3.6) - tzinfo (1.2.7) - thread_safe (~> 0.1) - unicode-display_width (1.6.0) - -PLATFORMS - ruby - -DEPENDENCIES - activesupport - binding_of_caller - mocha (~> 1.3.0) - octokit - rake - rspec - rubocop (>= 0.77.0) - -BUNDLED WITH - 1.17.2 - From 5846c63f8537ce89dfe87fc6171fd001a07b19d9 Mon Sep 17 00:00:00 2001 From: Samir Anand Date: Thu, 19 Jan 2023 15:05:59 +0530 Subject: [PATCH 2/4] adding action for automation --- .github/workflows/action.yml | 13 ++++++++----- generator.sh | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 821e217b2..96c88c791 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -11,17 +11,20 @@ jobs: - name: Execute code run: | # Run the code that generates the files - ruby code.rb + chmod +x generator.rb && ./generator.sh - name: Create new branch - uses: actions/create-branch@v1 + uses: peterjgrainger/action-create-branch@v2.2.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - repository: OWNER/DESTINATION-REPO - branch: feature-branch + branch: 'release-notes' + sha: '${{ github.event.pull_request.head.sha }}' + repository: inspec/inspec-gcp - name: Upload files uses: actions/upload-artifact@v1 with: name: files - path: path/to/generated/files + path: mmv1/build/inspec - name: Raise pull request uses: peter-evans/create-pull-request@v3 with: diff --git a/generator.sh b/generator.sh index e152499eb..7b31070d2 100644 --- a/generator.sh +++ b/generator.sh @@ -1 +1,3 @@ -compiler.rb -e inspec -p products/kms -t Location -o build/inspec \ No newline at end of file +cd mmv1 +rm -rf build/inspec +ruby compiler.rb -e inspec -p products/kms -t Location -o build/inspec \ No newline at end of file From def074cdeef1ca14791f16ebd4d0798e03469e61 Mon Sep 17 00:00:00 2001 From: Samir Anand Date: Thu, 19 Jan 2023 15:15:19 +0530 Subject: [PATCH 3/4] adding action for automation --- .github/workflows/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 96c88c791..1fd4ebd8d 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -11,7 +11,7 @@ jobs: - name: Execute code run: | # Run the code that generates the files - chmod +x generator.rb && ./generator.sh + chmod +x generator.sh && ./generator.sh - name: Create new branch uses: peterjgrainger/action-create-branch@v2.2.0 env: From 91da1424e366338eb09d421c00bc8ad5b83dec96 Mon Sep 17 00:00:00 2001 From: Samir Anand Date: Thu, 19 Jan 2023 15:19:29 +0530 Subject: [PATCH 4/4] adding action for automation --- generator.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/generator.sh b/generator.sh index 7b31070d2..74943bedc 100644 --- a/generator.sh +++ b/generator.sh @@ -1,3 +1,13 @@ +gem install bundler cd mmv1 +bundle install +./tools/doctor + +make terraform VERSION=ga OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" +make terraform VERSION=beta OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google-beta" + +# Only generate a specific product (plus all common files) +make terraform VERSION=ga OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" PRODUCT=dataproc + rm -rf build/inspec ruby compiler.rb -e inspec -p products/kms -t Location -o build/inspec \ No newline at end of file