2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-23 20:40:40 +03:00

chore(action): fix sponsors action; (#6557)

This commit is contained in:
Dmitriy Mozgovoy
2024-08-17 22:59:01 +03:00
committed by GitHub
parent d2c3d4183f
commit d93969177d
2 changed files with 11 additions and 8 deletions
+10 -7
View File
@@ -28,18 +28,21 @@ jobs:
id: sponsors id: sponsors
run: node ./bin/sponsors.js run: node ./bin/sponsors.js
- name: Notify status - name: Notify status
if: ${{ steps.sponsors.outputs.changed }} if: ${{ steps.sponsors.outputs.changed == 'true'}}
run: | run: |
echo "Sponsor block has changed. Creating PR with updates..." echo "Sponsor block has changed. Creating PR with updates..."
- name: Read sponsors.md file content - name: Read sponsors.md file content
id: read_file id: read_file
run: | run: |
FILE_CONTENT=$(cat ./temp/sponsors.md) echo 'CONTENT<<EOF' >> $GITHUB_ENV
echo "File content: $FILE_CONTENT" cat ./temp/sponsors.md >> $GITHUB_ENV
echo "::set-output name=file_content::$FILE_CONTENT" echo 'EOF' >> $GITHUB_ENV
shell: bash shell: bash
- name: Echo
run: |
echo "$CONTENT"
- name: Create pull request - name: Create pull request
if: ${{ steps.sponsors.outputs.changed }} if: ${{ steps.sponsors.outputs.changed == 'true'}}
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6
id: cpr id: cpr
with: with:
@@ -49,7 +52,7 @@ jobs:
title: '[Chore] Update sponsor block' title: '[Chore] Update sponsor block'
body: | body: |
**New sponsor block update:** **New sponsor block update:**
{{ steps.read_file.outputs.file_content }} ${{ env.CONTENT }}
labels: | labels: |
readme readme
automated pr automated pr
@@ -62,7 +65,7 @@ jobs:
#reviewers: jasonsaayman #reviewers: jasonsaayman
draft: false draft: false
- name: Show PR link - name: Show PR link
if: ${{ steps.sponsors.outputs.changed }} if: ${{ steps.sponsors.outputs.changed == 'true'}}
run: | run: |
echo "Sponsor block has changed. Creating PR..." echo "Sponsor block has changed. Creating PR..."
echo "Axios Release v${{ steps.package-version.outputs.current-version}}' pull request - ${{ steps.cpr.outputs.pull-request-url }}" echo "Axios Release v${{ steps.package-version.outputs.current-version}}' pull request - ${{ steps.cpr.outputs.pull-request-url }}"
+1 -1
View File
@@ -56,7 +56,7 @@ const updateReadmeSponsors = async (url, path, marker = '<!--<div>marker</div>--
(async(url) => { (async(url) => {
const newContent = await updateReadmeSponsors(url, './README.md'); const newContent = await updateReadmeSponsors(url, './README.md');
await exec(`echo "tag=${newContent ? 'true' : 'false'}" >> $GITHUB_OUTPUT`); await exec(`echo "changed=${newContent ? 'true' : 'false'}" >> $GITHUB_OUTPUT`);
if (newContent !== false) { if (newContent !== false) {
await fs.mkdir('./temp').catch(() => {}); await fs.mkdir('./temp').catch(() => {});
await fs.writeFile('./temp/sponsors.md', newContent); await fs.writeFile('./temp/sponsors.md', newContent);