forked from Shopify/ruby-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (73 loc) · 2.59 KB
/
dependabot_update_rbis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Update gem RBIs on Dependabot PRs
on:
workflow_dispatch:
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
secrets:
BUNDLER_GITHUB_TOKEN:
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: ${{ steps.ruby.outputs.version }}
- 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
- 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