Skip to content

update-readme

update-readme #66

Workflow file for this run

name: update-readme
on:
schedule:
- cron: '0 0 * * MON'
push:
branches:
- main
env:
BRANCH_NAME: update-date-in-readme
BASE_BRANCH_NAME: main
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
create-pr-if-outdated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ env.BASE_BRANCH_NAME }}
- name: update versions in readme.yml
run: |
argocd_version=$(yq '.bases[0]' contents/argocd/setup/kustomization.yaml | sed 's/.*?ref=\(.*\)/\1/')
yq -i "(.versions[] | select(.name == \"ArgoCD\").version) = \"$argocd_version\"" readme.yml
- name: set up
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: update readme
run: go run readme.go
- name: check if need to commit
id: need_commit
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "need_commit=true" >> "$GITHUB_OUTPUT"
else
echo "need_commit=false" >> "$GITHUB_OUTPUT"
fi
- name: update date in readme and commit
if: steps.need_commit.outputs.need_commit == 'true'
id: commit
run: |
git config user.name github-actions
git config user.email [email protected]
git checkout -b ${{ env.BRANCH_NAME }}
git add .
git commit -m 'update readme'
git push -u origin HEAD -f # nothing to commit
- name: check if pr exists
if: steps.need_commit.outputs.need_commit == 'true'
id: check_pr
run: |
echo "count=$(gh pr list -S head:${{ env.BRANCH_NAME }} -B ${{ env.BASE_BRANCH_NAME }} | wc -l)" > "$GITHUB_OUTPUT"
- name: create pr
if: ${{ steps.need_commit.outputs.need_commit == 'true' && steps.check_pr.outputs.count == 0 }}
run: |
gh pr create -B "${{ env.BASE_BRANCH_NAME }}" -t "Update version in README" -b ""