Skip to content

deps(deps): bump the go-modules group with 5 updates (#53) #41

deps(deps): bump the go-modules group with 5 updates (#53)

deps(deps): bump the go-modules group with 5 updates (#53) #41

Workflow file for this run

name: C4 Diagram
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
issues: write
pull-requests: write
concurrency:
group: c4-diagram-${{ github.ref }}
cancel-in-progress: true
jobs:
update:
name: update C4 diagram
if: github.repository == 'wallentx/jobscout'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out repository
uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true
- name: Actions Toolbox
uses: wallentx/gh-actions/composite/actions-toolbox@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
checkout: false
- name: Create bot token
id: app-token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ vars.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write
permission-issues: write
permission-pull-requests: write
- name: Regenerate C4 diagram
run: make c4-diagram
- name: Create C4 diagram update PR
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
BRANCH: automation/update-c4-diagram
run: |
set -euo pipefail
if git diff --quiet; then
echo "C4 diagram is already current."
exit 0
fi
git config user.name "jobscout-bot[bot]"
git config user.email "jobscout-bot[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git switch -c "$BRANCH"
git add docs/README.md
git commit -m "docs: update c4 diagram"
git push --force-with-lease origin "$BRANCH"
pr_number="$(
gh pr list \
--repo "$GITHUB_REPOSITORY" \
--head "$BRANCH" \
--state open \
--json number \
--jq '.[0].number // empty'
)"
if [ -n "$pr_number" ]; then
echo "C4 diagram update PR already exists: #$pr_number"
else
body="$(cat <<'EOF'
Regenerates the C4 component diagram after changes merged to main.
This PR is generated automatically when `make c4-diagram` changes the checked-in docs.
EOF
)"
gh pr create \
--repo "$GITHUB_REPOSITORY" \
--base main \
--head "$BRANCH" \
--title "Update C4 architecture diagram" \
--body "$body" \
--label changed \
--label documentation
fi