Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This allows generated code to be indexed correctly
*.rb linguist-generated=false
90 changes: 13 additions & 77 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,24 @@
# Maintained in moderation-api/sdk-generator (custom/ruby). Edits here are overwritten.
name: CI
on:
push:
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
branches: [main]
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

permissions:
contents: read

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/moderation-api-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
- uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
ruby-version: "3.2"
bundler-cache: false
- run: |-
bundle install

- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/moderation-api-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload gem artifacts
if: |-
github.repository == 'stainless-sdks/moderation-api-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: moderation_api
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
bundle install

- name: Run lints
run: ./scripts/lint
test:
timeout-minutes: 10
name: test
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
bundle install

- name: Run tests
run: ./scripts/test
- run: bundle install
- run: bundle exec rubocop --format github
- run: gem build moderation_api.gemspec
- name: Load the gem
run: bundle exec ruby -Ilib -e 'require "moderation_api"; require "moderation_api/webhook_signature"; ModerationApi::ModerationApi; ModerationApi::WebhookSignature'
33 changes: 16 additions & 17 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to rubygems.org in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/moderation-api/sdk-ruby/actions/workflows/publish-gem.yml
# Maintained in moderation-api/sdk-generator (custom/ruby). Edits here are overwritten.
name: Publish Gem
on:
workflow_dispatch:

release:
types: [published]
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
- uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
bundle install

- name: Publish to RubyGems.org
ruby-version: "3.2"
- name: Check the release tag matches the gem version
if: github.event_name == 'release'
run: |
bash ./bin/publish-gem
version=$(ruby -e 'puts Gem::Specification.load("moderation_api.gemspec").version')
if [ "${GITHUB_REF_NAME#v}" != "$version" ]; then
echo "::error::Release tag $GITHUB_REF_NAME does not match gem version $version"
exit 1
fi
- run: gem build moderation_api.gemspec
- run: gem push moderation_api-*.gem
env:
# `RUBYGEMS_HOST` is only required for private gem repositories, not https://rubygems.org
RUBYGEMS_HOST: ${{ secrets.MODERATION_API_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
GEM_HOST_API_KEY: ${{ secrets.MODERATION_API_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}
22 changes: 0 additions & 22 deletions .github/workflows/release-doctor.yml

This file was deleted.

19 changes: 9 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
*.gem
.idea/
.ignore
.prism.log
.stdy.log
.ruby-lsp/
.yardoc/
bin/tapioca
Brewfile.lock.json
doc/
sorbet/tapioca/*
.rbenv-gemsets
.DS_Store
**/.speakeasy/temp/
**/.speakeasy/logs/
.speakeasy/reports
bin/
sorbet/rbi
.env
.env.local
3 changes: 0 additions & 3 deletions .release-please-manifest.json

This file was deleted.

16 changes: 16 additions & 0 deletions .rubocop-strict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
inherit_from: .rubocop.yml

# Re-enable Style/StringLiterals for strict linting (e.g. internal CI).
# The base .rubocop.yml disables this rule so customers with single-quote
# conventions aren't broken. Use RUBOCOP_OPTS="--config .rubocop-strict.yml"
# to opt in to enforcement.
Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
Exclude:
- Gemfile
- "*.gemspec"
- lib/crystalline.rb
- lib/crystalline/**/*
- lib/**/sdk_hooks/**/*
- sorbet/**/*
Loading
Loading