-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
44 lines (39 loc) · 1.52 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: 'Update README with Badges'
description: 'A GitHub Action to update the README.md with badges'
author: 'Jeffrey Patton'
inputs:
project_name:
description: 'The project name'
required: true
github_owner:
description: 'GitHub repository owner'
required: false
default: ${{ github.repository_owner }} # Set the default to the current repo owner
github_repo:
description: 'GitHub repository name'
required: false
default: ${{ github.repository }} # Set the default to the current repo name
verbose:
description: 'Enable verbose output'
required: false
default: false
runs:
using: "composite"
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Run PowerShell script
shell: pwsh
run: |
$VerboseFlag = if (${{ inputs.verbose }}) { '-Verbose' } else { '' }
& $env:GITHUB_ACTION_PATH\\update-readme.ps1 -ProjectName '${{ inputs.project_name }}' -RootPath '${{ github.workspace }}' -GithubOwner '${{ inputs.github_owner }}' -GithubRepo '${{ inputs.github_repo }}' $env:VERBOSE
- name: Commit and push updated README.md
shell: bash
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add README.md
# Commit changes if any, and ignore if there are no changes
git commit -m "Update README with badges" || echo "No changes to commit"
# Push the changes if any were committed
git push || echo "No changes to push"