2023-01-03 17:56:08 +00:00
name : "Updatecli: Dependency Management"
on :
schedule :
# Runs at 06 PM UTC
2023-01-18 17:39:46 +00:00
- cron : '0 18 * * 0'
2023-01-03 17:56:08 +00:00
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch :
permissions :
2023-01-27 17:01:13 +00:00
contents : read
2023-01-03 17:56:08 +00:00
jobs :
updatecli :
runs-on : ubuntu-latest
2023-01-27 17:01:13 +00:00
permissions :
contents : write
issues : write
pull-requests : write
2023-01-03 18:26:14 +00:00
if : github.ref == 'refs/heads/master'
2023-01-03 17:56:08 +00:00
steps :
- name : Checkout
uses : actions/checkout@v3
- name : Install Go
uses : actions/setup-go@v3
with :
2023-04-03 18:40:49 +00:00
go-version : 'stable'
- name : Delete leftover UpdateCLI branches
run : |
gh pr list --search "is:closed is:pr head:updatecli_" --json headRefName --jq ".[].headRefName" | sort -u > closed_prs_branches.txt
gh pr list --search "is:open is:pr head:updatecli_" --json headRefName --jq ".[].headRefName" | sort -u > open_prs_branches.txt
for branch in $(comm -23 closed_prs_branches.txt open_prs_branches.txt); do if (git ls-remote --exit-code --heads origin "$branch"); then echo "Deleting leftover UpdateCLI branch - $branch"; git push origin --delete "$branch"; fi done
env :
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2023-01-03 17:56:08 +00:00
- name : Install Updatecli
uses : updatecli/updatecli-action@v2
- name : Apply Updatecli
# Never use '--debug' option, because it might leak the access tokens.
run : "updatecli apply --clean --config ./updatecli/updatecli.d/ --values ./updatecli/values.yaml"
env :
UPDATECLI_GITHUB_ACTOR : ${{ github.actor }}
UPDATECLI_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}