Created
January 7, 2022 10:18
-
-
Save heoelri/2f05a3bcb6da4991c3432b77e60d833d to your computer and use it in GitHub Desktop.
updateDependabot.yml GitHub Actions workflow executing update-dependabot.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Dependabot config | |
on: push | |
jobs: | |
UpdateDependabot: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Update Dependabot | |
shell: pwsh | |
run: | | |
./.github/scripts/update-dependabot.ps1 -targetBranch component-updates -outputFile ./.github/dependabot.yml | |
- name: Push files to repo | |
shell: pwsh | |
run: | | |
# Set the name on the commits as it will appear in Github | |
git config --global user.name 'Github Action' | |
git config --global user.email '[email protected]' | |
git add /.github/dependabot.yml | |
# Get the name of the commit that triggered the workflow, | |
# so we can refer to it in our automated commit message. | |
$message = git log -1 --pretty=format:"%s" | |
# Only commit if there are changes to commit, otherwise commit will throw an error. | |
if(git status -uno --short) { | |
git commit -m "Auto update: $message" | |
git push origin | |
} | |
else { | |
Write-Output "No changes to commit. Bye." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment