Skip to content

Update gem RBIs on Dependabot PRs #8

Update gem RBIs on Dependabot PRs

Update gem RBIs on Dependabot PRs #8

name: Update gem RBIs on Dependabot PRs
on:
workflow_dispatch:
inputs:
dependency_setup_command:
description: A bash script that sets up manually-required dependencies
type: string
required: false
tapioca_env_vars:
description: A space-delimited list of environment variables and their values, to be passed to the `tapioca gem` command
type: string
required: false
valid_actors:
description: A stringified list of GitHub actors that can trigger this job
type: string
default: '["dependabot[bot]"]'
required: false
workflow_call:
inputs:
dependency_setup_command:
description: A bash script that sets up manually-required dependencies
type: string
required: false
tapioca_env_vars:
description: A space-delimited list of environment variables and their values, to be passed to the `tapioca gem` command
type: string
required: false
valid_actors:
description: A stringified list of GitHub actors that can trigger this job
type: string
default: '["dependabot[bot]"]'
required: false
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: 30
#if: ${{ contains(fromJson(inputs.valid_actors), github.actor) }}
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# - name: Get Ruby version
# do we need this?
- name: Set up any manually specified dependencies
if: ${{ inputs.dependency_setup_command != '' }}
run: ${{ inputs.dependency_setup_command }}
env:
DEBIAN_FRONTEND: noninteractive
- uses: ruby/setup-ruby@v1
id: setup
with:
bundler-cache: true
ruby-version: 3.2
- name: Ruby setup error details
if: ${{ failure() && steps.setup.conclusion == 'failure' }}
run: |
echo "A failure during the Ruby setup step could indicate that the permissions" \
" for this repo are not configured correctly." \
exit 1
- name: Update gem RBIs
run: |
${{ inputs.tapioca_env_vars }} bin/tapioca gem --workers=1
- 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