Skip to content

Update Readme Downloads #14

Update Readme Downloads

Update Readme Downloads #14

# This workflow version increments all modules
name: Update Readme Downloads
# Controls when the action will run.
on:
schedule:
- cron: "0 0 * * 1,4"
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-2019
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
#Run pwsh functions to publish the module
- name: Update Downloads count
env:
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
shell: powershell
run: |
#Import and Run Scripts
$workingdirectory = (Get-Location).path
. "$workingdirectory\.github\workflows\scripts\Get-TotalDownloads.ps1"
$old = [string](Get-Content $workingdirectory\readme.md | Select-String "downloads as of ")
$new = get-totaldownloads
$content = [System.IO.File]::ReadAllText("$workingdirectory\readme.md").Replace("$old", "$new")
[System.IO.File]::WriteAllText("$workingdirectory\readme.md", $content)
#Publish new manifest files to the repository
git config --global user.email $env:GIT_EMAIL
git config --global user.name "TheTaylorLee"
git add -A
git commit -m "doc: update readme downloads"
git push -u origin main