forked from Shopify/ruby-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
git add sorbet/* | ||
date="$(date -u +"%Y-%m-%d")" | ||
git commit -m "Update RBI files for gems ${date} [dependabot skip]" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters