diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 527aa12e6..473c7ea93 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -7,6 +7,7 @@ on: types: [opened, synchronize] issue_comment: types: [created] + workflow_call: jobs: cla: @@ -15,10 +16,10 @@ jobs: pull-requests: write runs-on: ubuntu-latest if: | - (github.event.issue.pull_request - && !github.event.issue.pull_request.merged_at - && contains(github.event.comment.body, 'signed') - ) + github.event_name == 'workflow_dispatch' + || (github.event.issue.pull_request + && !github.event.issue.pull_request.merged_at + && contains(github.event.comment.body, 'signed')) || (github.event.pull_request && !github.event.pull_request.merged) steps: - uses: Shopify/shopify-cla-action@v1 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 0d8ed846c..43214abaa 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -64,7 +64,8 @@ jobs: name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: - fetch-depth: 30 + ref: main + fetch-depth: 0 fetch-tags: true - name: Set up Ruby @@ -91,28 +92,95 @@ jobs: "${{ needs.read-version.outputs.new_version }}" \ "${{ needs.read-version.outputs.current_version }}" - - name: Create pull request - env: - GH_TOKEN: ${{ github.token }} + name: Create and push branch run: | new_version="${{ needs.read-version.outputs.new_version }}" branch_name="release/v$new_version" - # Configure git git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" - # Create and checkout new branch git checkout -b "$branch_name" - - # Add and commit changes - git add lib/semian/version.rb Gemfile.lock CHANGELOG.md - git commit -m "Bump version to $new_version" -m "Triggered by @${{ github.actor }}" - - # Push the branch git push origin "$branch_name" + - + name: Create signed commit + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + github-token: ${{ github.token }} + script: | + const { execSync } = require('child_process'); + const fs = require('fs'); + const message = 'Bump version to ${{ needs.read-version.outputs.new_version }}'; + const directory = '.'; + + execSync(`git add ${directory}`); + + const gitCmd = `git -c core.quotePath=false status ${directory} --porcelain=v1`; + const status = execSync(gitCmd).toString(); + const fileChanges = status + .split('\n') + .filter(line => line) + .map(line => { + const [_, status, path] = line.match(/^(.). (.*)/); + + if (status === 'R') { + const [oldPath, newPath] = path.split(' -> '); + return [ + { path: newPath, contents: fs.readFileSync(newPath).toString('base64') }, + { path: oldPath, contents: null } + ]; + } + + return [{ + path, + contents: status !== 'D' ? fs.readFileSync(path).toString('base64') : null + }]; + }) + .flat(); + + const additions = fileChanges.filter(f => f.contents !== null); + const deletions = fileChanges + .filter(f => f.contents === null) + .map(f => ({ path: f.path })); + + console.log('Committing changes:'); + additions.forEach(file => console.log(` + ${file.path}`)); + deletions.forEach(file => console.log(` - ${file.path}`)); + + const branch = 'release/v${{ needs.read-version.outputs.new_version }}'; + console.log(`Target branch: ${branch}`); + + const query = ` + mutation CreateCommit($input: CreateCommitOnBranchInput!) { + createCommitOnBranch(input: $input) { + commit { + url + } + } + } + `; + + const result = await github.graphql(query, { + input: { + branch: { + repositoryNameWithOwner: `${context.repo.owner}/${context.repo.repo}`, + branchName: branch + }, + message: { headline: message }, + fileChanges: { additions, deletions }, + expectedHeadOid: context.sha + } + }); + + console.log(`Commit created: ${result.createCommitOnBranch.commit.url}`); + - + name: Create pull request + env: + GH_TOKEN: ${{ github.token }} + run: | + new_version="${{ needs.read-version.outputs.new_version }}" + branch_name="release/v$new_version" - # Create pull request gh pr create \ --title "Release v$new_version" \ --body "Automated version bump to $new_version @@ -129,3 +197,12 @@ jobs: build the gem and publish it to GitHub releases." \ --base main \ --head "$branch_name" + + cla: + name: Run CLA check + needs: [create-pr] + permissions: + actions: write + pull-requests: write + uses: ./.github/workflows/cla.yml + secrets: inherit diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c6d6c215..97ceeb2b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# v0.26.7 + +* use the correct bot for github actions (#998) +* Redis: Namespace the added OOM error class attr +* Redis: Add OOM configuration leak tests +* Redis: Better command wording 2/2 +* Redis: Better command wording 1/2 +* Redis: Make OOM Errors configurable for circuit opening +* Redis: Do not open circuit on OOM +* Refresh dependencies for all adapters and fix time helper (#941) +* Bump edge Rails +* Add support for Active Record's PostgreSQL Adapter +* Accept `QueryIntent` from Active Record 8.2 in `execute_intent` +* Modify release workflow to preview changes through a PR (#825) +* Use GitHub assets for RELEASE.md images (#816) +* Create GitHub Action to publish new release (#779) + # v0.26.6 * Remove force_config_validation spammy log diff --git a/Gemfile.lock b/Gemfile.lock index af0bd1c8c..a2410d8c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,7 +26,7 @@ GIT PATH remote: . specs: - semian (0.26.6) + semian (0.26.7) concurrent-ruby GEM diff --git a/lib/semian/version.rb b/lib/semian/version.rb index 51bd84b50..08d31c05c 100644 --- a/lib/semian/version.rb +++ b/lib/semian/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Semian - VERSION = "0.26.6" + VERSION = "0.26.7" end