{"id":13897529,"url":"https://github.com/k1LoW/github-script-ruby","last_synced_at":"2025-07-17T14:32:10.305Z","repository":{"id":44946298,"uuid":"416184716","full_name":"k1LoW/github-script-ruby","owner":"k1LoW","description":"Write workflows scripting the GitHub API in Ruby","archived":false,"fork":false,"pushed_at":"2024-06-21T02:51:04.000Z","size":104,"stargazers_count":27,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-16T06:11:43.431Z","etag":null,"topics":["actions","github-api","ruby"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/github-script-for-ruby","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k1LoW.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"k1LoW","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-10-12T04:36:23.000Z","updated_at":"2024-07-05T10:46:08.000Z","dependencies_parsed_at":"2024-06-21T16:33:34.876Z","dependency_job_id":"de900264-71df-4f02-9be1-c49f39d32e2f","html_url":"https://github.com/k1LoW/github-script-ruby","commit_stats":{"total_commits":140,"total_committers":3,"mean_commits":"46.666666666666664","dds":0.2571428571428571,"last_synced_commit":"65c05ca1029fca20cdb6048069828cba6fbcfcb3"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgithub-script-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgithub-script-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgithub-script-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgithub-script-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k1LoW","download_url":"https://codeload.github.com/k1LoW/github-script-ruby/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226270782,"owners_count":17598076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","github-api","ruby"],"created_at":"2024-08-06T18:03:40.051Z","updated_at":"2024-11-25T03:31:34.301Z","avatar_url":"https://github.com/k1LoW.png","language":"Ruby","readme":"# github-script-ruby [![Test](https://github.com/k1LoW/github-script-ruby/actions/workflows/test.yml/badge.svg)](https://github.com/k1LoW/github-script-ruby/actions/workflows/test.yml) ![Coverage](https://raw.githubusercontent.com/k1LoW/octocovs/main/badges/k1LoW/github-script-ruby/coverage.svg) ![Code to Test Ratio](https://raw.githubusercontent.com/k1LoW/octocovs/main/badges/k1LoW/github-script-ruby/ratio.svg) ![Test Execution Time](https://raw.githubusercontent.com/k1LoW/octocovs/main/badges/k1LoW/github-script-ruby/time.svg)\n\nThis action makes it easy to write Ruby scripts in the workflow, just like [actions/github-script](https://github.com/actions/github-script).\n\nIn order to use this action, a `script` input is provided. The value of that input should be the body of an function call. The following arguments will be provided:\n\n- `github` A pre-authenticated [octokit.rb](https://github.com/octokit/octokit.rb) client with `auto_paginate=true`\n- `context` An OpenStruct instance containing the context of the workflow run\n- `core` An instance of [GitHub::Actions::Toolkit::Core](lib/github/actions/toolkit/core.rb)\n\n## Examples\n\n### Print the available attributes of context\n\nref: [actions/github-script example](https://github.com/actions/github-script#print-the-available-attributes-of-context)\n\n``` yaml\n- name: View context attributes\n  uses: k1LoW/github-script-ruby@v2\n  with:\n    script: pp context\n```\n### Comment on an issue\n\nref: [actions/github-script example](https://github.com/actions/github-script#comment-on-an-issue)\n\n``` yaml\non:\n  issues:\n    types: [opened]\n\njobs:\n  comment:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: k1LoW/github-script-ruby@v2\n        with:\n          script: |\n            repo = \"#{context.repo.owner}/#{context.repo.repo}\"\n            number = context.issue.number\n            comment = '👋 Thanks for reporting!'\n            github.add_comment(repo, number, comment)\n```\n\n### Use Gem packages\n\nIt is possible to change the Gemfile to use.\n\nIf you want to use octokit.rb, don't forget to add it.\n\n``` yaml\n- name: 'Post message to Slack #general channel'\n  uses: k1LoW/github-script-ruby@v2\n  with:\n    script: |\n      require 'slack-ruby-client'\n      Slack.configure do |config|\n        config.token = ENV['SLACK_API_TOKEN']\n      end\n      client = Slack::Web::Client.new\n      client.chat_postMessage(channel: '#general', text: 'Hello, Slack bot!')\n    gemfile: |\n      source 'https://rubygems.org'\n      gem 'octokit', '~\u003e 4.0'\n      gem 'slack-ruby-client'\n  env:\n    SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}\n```\n\n### Pre-install packages for building native extentions.\n\n``` yaml\n- name: 'List users'\n  uses: k1LoW/github-script-ruby@v2\n  with:\n    script: |\n      require 'mysql2'\n      client = Mysql2::Client.new(:host =\u003e \"localhost\", :username =\u003e \"root\")\n      client.query('SELECT * FROM users').each do |row|\n        puts row['name']\n      end\n    pre-command: |\n      apt-get update\n      apt-get install -y libmysqld-dev\n    gemfile: |\n      source 'https://rubygems.org'\n      gem 'mysql2'\n```\n\n### Change Ruby version of use\n\n``` yaml\n- name: 'Hello Ruby version'\n  uses: k1LoW/github-script-ruby@v2\n  with:\n    script: |\n      repo = \"#{context.repo.owner}/#{context.repo.repo}\"\n      number = context.issue.number\n      comment = \"Hello using Ruby v#{RUBY_VERSION}\"\n      github.add_comment(repo, number, comment)\n    ruby-version: 2.7.5\n```\n\nThe `ruby-version:` feature is realized using the prebuilt Ruby releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder)\n\n### Execute Ruby script file\n\n``` yaml\n- name: 'Capistrano deploy'\n  uses: k1LoW/github-script-ruby@v2\n  with:\n    gemfile-path: path/to/Gemfile\n    command: bundle exec cap deploy --gemfile=path/to/Gemfile\n    ruby-version: 2.7.5\n```\n\n## References\n\n- [actions/github-script](https://github.com/actions/github-script): Write workflows scripting the GitHub API in JavaScript\n- [ruby/setup-ruby](https://github.com/ruby/setup-ruby): An action to download a prebuilt Ruby and add it to the PATH in 5 seconds\n","funding_links":["https://github.com/sponsors/k1LoW"],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk1LoW%2Fgithub-script-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk1LoW%2Fgithub-script-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk1LoW%2Fgithub-script-ruby/lists"}