|
| 1 | +name: Bump Bundler Version |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [ develop ] |
| 7 | + paths: |
| 8 | + - '.ruby-version' |
| 9 | + |
| 10 | +jobs: |
| 11 | + bump-bundler: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + pull-requests: write |
| 16 | + env: |
| 17 | + BUNDLE_GEMFILE: ${{ github.workspace }}/spec/Gemfile |
| 18 | + steps: |
| 19 | + - uses: hmarr/debug-action@v3 |
| 20 | + - uses: actions/checkout@v5 |
| 21 | + - uses: ruby/setup-ruby@v1 |
| 22 | + with: |
| 23 | + bundler-cache: true |
| 24 | + - name: Update BUNDLED WITH in Gemfile.lock |
| 25 | + run: | |
| 26 | + echo "Remove all bundler versions except the default one" |
| 27 | + gem uninstall bundler -a -x |
| 28 | +
|
| 29 | + ruby -v |
| 30 | + bundler -v |
| 31 | +
|
| 32 | + # We are modifying the Gemfile.lock, thus have to set frozen to false. |
| 33 | + bundle config set frozen false |
| 34 | +
|
| 35 | + BUNDLER_VERSION=$(ruby -rbundler -e 'puts Bundler::VERSION') |
| 36 | + |
| 37 | + pushd spec |
| 38 | + echo "Update bundler version in Gemfile.lock" |
| 39 | + bundle update --bundler=$BUNDLER_VERSION |
| 40 | + popd |
| 41 | +
|
| 42 | + # Don't commit changes in vendor/bundle folder. |
| 43 | + echo "vendor/bundle/" >> .git/info/exclude |
| 44 | +
|
| 45 | + if git diff --quiet; then |
| 46 | + echo "changes=false" >> $GITHUB_ENV |
| 47 | + else |
| 48 | + echo "changes=true" >> $GITHUB_ENV |
| 49 | + fi |
| 50 | + - name: Create or Update Pull Request |
| 51 | + if: env.changes == 'true' |
| 52 | + uses: peter-evans/create-pull-request@v7 |
| 53 | + with: |
| 54 | + branch: bump-bundler-version-${{ github.ref_name }} |
| 55 | + title: "Automated Bump of Bundler Version in Gemfile.lock" |
| 56 | + body: | |
| 57 | + This PR updates Gemfile.lock to use the default Bundler version. |
| 58 | + labels: "needs_review" |
| 59 | + commit-message: "Bump Bundler Version in Gemfile.lock" |
| 60 | + committer: "ari-wg-gitbot <app-runtime-interfaces@cloudfoundry.org>" |
| 61 | + author: "ari-wg-gitbot <app-runtime-interfaces@cloudfoundry.org>" |
0 commit comments