Remove unused variable warning #49
This file contains hidden or 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
name: Misc | |
on: [push, pull_request, merge_group] | |
concurrency: | |
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }} | |
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }} | |
permissions: | |
contents: read | |
jobs: | |
checks: | |
name: Miscellaneous checks | |
permissions: | |
contents: write # for Git to git push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
fetch-depth: 100 # for notify-slack-commits | |
token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }} | |
# Run this step first (even before `make up` in the next step) to make the notification available before any other failure | |
- name: Notify commit to Slack | |
run: ruby tool/notify-slack-commits.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" refs/heads/master | |
env: | |
GITHUB_OLD_SHA: ${{ github.event.before }} | |
GITHUB_NEW_SHA: ${{ github.event.after }} | |
SLACK_WEBHOOK_URL_ALERTS: ${{ secrets.SLACK_WEBHOOK_URL_ALERTS }} | |
SLACK_WEBHOOK_URL_COMMITS: ${{ secrets.SLACK_WEBHOOK_URL_COMMITS }} | |
SLACK_WEBHOOK_URL_RUBY_JP: ${{ secrets.SLACK_WEBHOOK_URL_RUBY_JP }} | |
if: ${{ github.repository == 'ruby/ruby' && github.ref == 'refs/heads/master' && github.event_name == 'push' }} | |
continue-on-error: true # The next auto-style should always run | |
- uses: ./.github/actions/setup/directories | |
with: | |
makeup: true | |
# Skip overwriting MATZBOT_AUTO_UPDATE_TOKEN | |
checkout: '' # false (ref: https://github.com/actions/runner/issues/2238) | |
# Run this step early to make sure auto-style commits are pushed | |
- name: Auto-correct code styles | |
run: | | |
set -x | |
ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" refs/heads/master | |
env: | |
GITHUB_OLD_SHA: ${{ github.event.before }} | |
GITHUB_NEW_SHA: ${{ github.event.after }} | |
GIT_AUTHOR_NAME: git | |
GIT_COMMITTER_NAME: git | |
EMAIL: svn-admin@ruby-lang.org | |
if: ${{ github.repository == 'ruby/ruby' && github.ref == 'refs/heads/master' && github.event_name == 'push' }} | |
- name: Check for code styles | |
run: | | |
set -x | |
ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" | |
env: | |
GITHUB_OLD_SHA: ${{ github.event.pull_request.base.sha }} | |
GITHUB_NEW_SHA: ${{ github.event.pull_request.merge_commit_sha }} | |
if: ${{ github.repository == 'ruby/ruby' && startsWith(github.event_name, 'pull') }} | |
- name: Check if C-sources are US-ASCII | |
run: | | |
grep -r -n --include='*.[chyS]' --include='*.asm' $'[^\t-~]' -- . && exit 1 || : | |
- name: Check for bash specific substitution in configure.ac | |
run: | | |
git grep -n '\${[A-Za-z_0-9]*/' -- configure.ac && exit 1 || : | |
- name: Check for header macros | |
run: | | |
fail= | |
for header in ruby/*.h; do | |
git grep -l -F -e $header -e HAVE_`echo $header | tr a-z./ A-Z__` -- . > /dev/null && continue | |
fail=1 | |
echo $header | |
done | |
exit $fail | |
working-directory: include | |
- name: Check if to generate documents | |
id: rdoc | |
run: | | |
ref=$(sed 's/#.*//;/^rdoc /!d' gems/bundled_gems | awk '{print $4}') | |
echo ref=$ref >> $GITHUB_OUTPUT | |
# Generate only when document commit/PR | |
if: >- | |
${{false | |
|| contains(github.event.head_commit.message, '[ruby/rdoc]') | |
|| contains(github.event.head_commit.message, '[DOC]') | |
|| contains(github.event.pull_request.title, '[DOC]') | |
|| contains(github.event.pull_request.labels.*.name, 'Documentation') | |
}} | |
- name: Checkout rdoc | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
repository: ruby/rdoc | |
ref: ${{ steps.rdoc.outputs.ref }} | |
path: .bundle/gems/rdoc-0 | |
if: ${{ steps.rdoc.outputs.ref != '' }} | |
- name: Generate rdoc | |
run: | | |
set -x | |
gempath=$(ruby -e 'print Gem.user_dir, "/bin"') | |
PATH=$gempath:$PATH | |
gem install --user bundler | |
bundle config --local path vendor/bundle | |
bundle install --jobs 4 | |
bundle exec rake generate | |
working-directory: .bundle/gems/rdoc-0 | |
if: ${{ steps.rdoc.outputs.ref != '' }} | |
- name: Generate docs | |
id: docs | |
run: | | |
$RDOC -C -x ^ext -x ^lib . | |
$RDOC --op html . | |
echo htmlout=ruby-html-${GITHUB_SHA:0:10} >> $GITHUB_OUTPUT | |
env: | |
RDOC: ruby -W0 --disable-gems tool/rdoc-srcdir -q | |
if: ${{ steps.rdoc.outcome == 'success' }} | |
- name: Upload docs | |
uses: actions/upload-artifact@v4 | |
with: | |
path: html | |
name: ${{ steps.docs.outputs.htmlout }} | |
if: ${{ steps.docs.outcome == 'success' }} | |
- name: Push PR notes to GitHub | |
run: ruby tool/notes-github-pr.rb "$(pwd)/.git" "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" refs/heads/master | |
env: | |
GITHUB_OLD_SHA: ${{ github.event.before }} | |
GITHUB_NEW_SHA: ${{ github.event.after }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GIT_AUTHOR_NAME: git | |
GIT_COMMITTER_NAME: git | |
EMAIL: svn-admin@ruby-lang.org | |
if: ${{ github.repository == 'ruby/ruby' && github.ref == 'refs/heads/master' && github.event_name == 'push' }} | |
- uses: ./.github/actions/slack | |
with: | |
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot | |
if: ${{ failure() }} |