name: Miscellaneous checks on: push: branches: [ "master" ] pull_request: branches: [ "master" ] merge_group: branches: [ "master" ] 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: permissions: contents: write # for Git to git push runs-on: ubuntu-latest steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - name: Check if C-sources are US-ASCII run: | ! grep -r -n '[^ -~]' -- *.[chy] include internal win32/*.[ch] - name: Check for trailing spaces run: | ! git grep -n '[ ]$' -- '*.rb' '*.[chy]' '*.rs' ! git grep -n '^[ ][ ]*$' -- '*.md' - name: Check for bash specific substitution in configure.ac run: | ! git grep -n '\${[A-Za-z_0-9]*/' -- configure.ac - name: Check for header macros run: | ! for header in ruby/*.h; do \ git grep -l -F -e $header -e HAVE_`echo $header | tr a-z./ A-Z__` -- . > /dev/null || echo $header done | grep -F . working-directory: include - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: .downloaded-cache key: downloaded-cache-${{ github.sha }} restore-keys: | downloaded-cache - name: Download previous gems list run: | data=default_gems.json mkdir -p .downloaded-cache ln -s .downloaded-cache/$data . curl -O -R -z ./$data https://stdgems.org/$data - name: Make default gems list run: | #!ruby require 'rubygems' $:.unshift "lib" rgver = File.foreach("lib/rubygems.rb") do |line| break $1 if /^\s*VERSION\s*=\s*"([^"]+)"/ =~ line end gems = Dir.glob("{ext,lib}/**/*.gemspec").map do |f| spec = Gem::Specification.load(f) "#{spec.name} #{spec.version}" end.sort File.open("gems/default_gems", "w") do |f| f.puts "RubyGems #{rgver}" f.puts gems end shell: ruby --disable=gems {0} - name: Maintain updated gems list in NEWS run: | ruby tool/update-NEWS-gemlist.rb default - name: Check diffs id: diff run: | git diff --color --no-ext-diff --ignore-submodules --exit-code NEWS.md continue-on-error: true - name: Commit run: | git pull --ff-only origin ${GITHUB_REF#refs/heads/} git commit --message="Update default gems list at ${GITHUB_SHA:0:30} [ci skip]" NEWS.md git push origin ${GITHUB_REF#refs/heads/} env: EMAIL: svn-admin@ruby-lang.org GIT_AUTHOR_NAME: git GIT_COMMITTER_NAME: git if: ${{ github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull') && steps.diff.outcome == 'failure' }} - uses: ruby/action-slack@0bd85c72233cdbb6a0fe01d37aaeff1d21b5fce1 # v3.2.1 with: payload: | { "ci": "GitHub Actions", "env": "${{ github.workflow }}", "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", "commit": "${{ github.sha }}", "branch": "${{ github.ref_name }}" } env: SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot if: ${{ failure() && github.event_name == 'push' }}