Skip to content

Update Avatars in README.md #2

Update Avatars in README.md

Update Avatars in README.md #2

Workflow file for this run

name: Update Avatars in README.md
on: [workflow_dispatch]
jobs:
update:
runs-on: windows-latest
steps:
-
name: Checkout code
uses: actions/checkout@v4
-
name: Get new Avatar URL
id: fetch_new_url
run: |
$query_string = "apikey=${{ secrets.LI_API_KEY }}&linkedinUrl=${{ vars.RK_PROFILE }}"
$end_point_url = "${{ vars.LI_API }}?$query_string"
$response = Invoke-RestMethod -Uri $end_point_url
$profile_img_url = $response.person.photoUrl
echo "::set-output name=img_url::$profile_img_url"
-
name: Replace old URL with New
run: |
$file_path = "README.md"
$new_url = "${{ steps.fetch_new_url.outputs.img_url }}"
$content = Get-Content -Path $file_path
$updated_content = $content -replace 'src="https://[^"]*"', "src=`"$new_url`""
Set-Content -Path $file_path -Value $updated_content
-
name: Push changes
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git commit -am "Updated avatar on README.md"
git push