File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed
Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -93,12 +93,29 @@ jobs:
9393
9494 - name : Find and replace image URLs in step files
9595 if : steps.get-template-repo.outputs.TEMPLATE_REPOSITORY != ''
96- uses : jacobtomlinson/gha-find-replace@v3
96+ uses : actions/github-script@v8
97+ env :
98+ STEP_FILES_GLOB : .github/steps/*.md
9799 with :
98- find : ' \.\./images/'
99- replace : ' https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/.github/images/'
100- include : ' .github/steps/*.md'
101- regex : true
100+ script : |
101+ const fs = require('fs');
102+
103+ const globber = await glob.create(process.env.STEP_FILES_GLOB);
104+ const files = await globber.glob();
105+
106+ files.forEach(file => {
107+ const content = fs.readFileSync(file, 'utf8');
108+
109+ // Replace ../images/* links with GitHub blob URLs suffixed with ?raw=true.
110+ const updatedContent = content.replace(
111+ /\.\.\/images\/([^\s)"']+)/g,
112+ 'https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/.github/images/$1?raw=true'
113+ );
114+
115+ if (content !== updatedContent) {
116+ fs.writeFileSync(file, updatedContent, 'utf8');
117+ }
118+ });
102119
103120 - name : Build welcome message from template
104121 id : build-issue-description
You can’t perform that action at this time.
0 commit comments