diff --git a/.github/workflows/dependabot_update_rbis.yml b/.github/workflows/dependabot_update_rbis.yml new file mode 100644 index 000000000..226424b27 --- /dev/null +++ b/.github/workflows/dependabot_update_rbis.yml @@ -0,0 +1,57 @@ +name: Update gem RBIs on Dependabot PRs + +on: workflow_call + +permissions: + contents: write + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + update-gem-rbis: + runs-on: ubuntu-latest + timeout-minutes: 15 + if: ${{ github.actor == '"dependabot[bot]"' }} + steps: + - name: Checkout PR branch + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Get Ruby version from dev.yml + id: ruby + shell: ruby -ryaml {0} + run: | + exit 1 unless File.exist?("dev.yml") + yaml = YAML.respond_to?(:unsafe_load_file) ? YAML.unsafe_load_file("dev.yml") : YAML.load_file("dev.yml") + ruby_version = yaml["up"] + &.find {|h| Hash === h && h.key?("ruby") } + &.dig("ruby") + .then {|c| Hash === c ? c["version"] : c } + exit 1 unless ruby_version + File.write(ENV.fetch("GITHUB_OUTPUT"), "ruby_version=#{ruby_version}\n", mode: "a") + - uses: ruby/setup-ruby@v1 + id: setup + with: + bundler-cache: true + ruby-version: ${{ steps.ruby.outputs.version }} + - name: Update gem RBIs + run: | + bin/tapioca gem + - name: Check for modified files + id: git_modified_files_check + # If there are changes in the sorbet directory, `echo -n` will return true (zero exit code) + run: | + status=$(git status sorbet --porcelain=v1) + echo "changes=$([ -n "$status" ]; echo $?)" >> $GITHUB_OUTPUT + - name: Push changes + if: ${{ steps.git_modified_files_check.outputs.changes == 0 }} + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add sorbet/* + date="$(date -u +"%Y-%m-%d")" + git commit -m "Update RBI files for gems ${date} [dependabot skip]" + git push diff --git a/.github/workflows/dependabot_update_rbis_run.yml b/.github/workflows/dependabot_update_rbis_run.yml new file mode 100644 index 000000000..7c6c18b3a --- /dev/null +++ b/.github/workflows/dependabot_update_rbis_run.yml @@ -0,0 +1,6 @@ +name: Update gem RBIs on Dependabot PRs +on: [pull_request] + +jobs: + dependabot_update_rbis: + uses: Shopify/ruby-lsp/.github/workflows/dependabot_update_rbis.yml@main diff --git a/sorbet/tapioca/config.yml b/sorbet/tapioca/config.yml index f69d732b6..6b6939299 100644 --- a/sorbet/tapioca/config.yml +++ b/sorbet/tapioca/config.yml @@ -3,8 +3,9 @@ gem: "psych": "false" # Add your `gem` command parameters here: # - # exclude: - # - gem_name + # rdoc causes a failure 'webrick is not found.' when running `tapioca gem`. + exclude: + - rdoc # doc: true # workers: 5 dsl: