@@ -61,22 +61,50 @@ jobs:
6161 exit $fail
6262 working-directory : include
6363
64- - name : Generate docs
65- id : docs
64+ - name : Check if to generate documents
65+ id : rdoc
6666 run : |
67- ruby -W0 --disable-gems tool/rdoc-srcdir -q --op html .
68- echo htmlout=ruby-html-${GITHUB_SHA:0:10} >> $GITHUB_OUTPUT
67+ ref=$(sed 's/#.*//;/^rdoc /!d' gems/bundled_gems | awk '{print $4}')
68+ echo ref=$ref >> $GITHUB_OUTPUT
6969 # Generate only when document commit/PR
7070 if : >-
7171 ${{false
7272 || contains(github.event.head_commit.message, '[ruby/rdoc]')
7373 || contains(github.event.head_commit.message, '[DOC]')
74- || contains(github.event.head_commit.message, 'Document')
7574 || contains(github.event.pull_request.title, '[DOC]')
76- || contains(github.event.pull_request.title, 'Document')
7775 || contains(github.event.pull_request.labels.*.name, 'Documentation')
7876 }}
7977
78+ - name : Checkout rdoc
79+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
80+ with :
81+ repository : ruby/rdoc
82+ ref : ${{ steps.rdoc.outputs.ref }}
83+ path : .bundle/gems/rdoc-0
84+ if : ${{ steps.rdoc.outputs.ref != '' }}
85+
86+ - name : Generate rdoc
87+ run : |
88+ set -x
89+ gempath=$(ruby -e 'print Gem.user_dir, "/bin"')
90+ PATH=$gempath:$PATH
91+ gem install --user bundler
92+ bundle config --local path vendor/bundle
93+ bundle install --jobs 4
94+ bundle exec rake generate
95+ working-directory : .bundle/gems/rdoc-0
96+ if : ${{ steps.rdoc.outputs.ref != '' }}
97+
98+ - name : Generate docs
99+ id : docs
100+ run : |
101+ $RDOC -C -x ^ext -x ^lib .
102+ $RDOC --op html .
103+ echo htmlout=ruby-html-${GITHUB_SHA:0:10} >> $GITHUB_OUTPUT
104+ env :
105+ RDOC : ruby -W0 --disable-gems tool/rdoc-srcdir -q
106+ if : ${{ steps.rdoc.outcome == 'success' }}
107+
80108 - name : Upload docs
81109 uses : actions/upload-artifact@v4
82110 with :
0 commit comments