Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/diff-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Diff chart changes
on:
pull_request:
types: [opened, reopened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.repository }}-${{ github.ref_name }}
cancel-in-progress: false

jobs:
render-charts-base:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }}
show-progress: false
- name: Run govuk-app-render
run: ./govuk-app-render.sh
- name: Archive rendered charts
uses: actions/upload-artifact@v4
with:
name: rendered-charts-base
path: output/
retention-days: 1
render-charts-head:
Comment on lines +11 to +26

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
show-progress: false
- name: Run govuk-app-render
run: ./govuk-app-render.sh
- name: Archive rendered charts
uses: actions/upload-artifact@v4
with:
name: rendered-charts-head
path: output/
retention-days: 1
diff-charts:
Comment on lines +27 to +42

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
needs: [render-charts-base, render-charts-head]
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
show-progress: false
- uses: actions/download-artifact@v4
with:
name: rendered-charts-base
path: base-r/
- uses: actions/download-artifact@v4
with:
name: rendered-charts-head
path: head-r/
- name: Diff charts and comment on PR
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: ./create-diff-pr.sh
2 changes: 1 addition & 1 deletion charts/app-config/values-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ govukApplications:
memory: 4Gi
requests:
cpu: 10m
memory: 2Gi
memory: 4Gi
redis:
enabled: true
ingress:
Expand Down
1 change: 1 addition & 0 deletions charts/generic-govuk-app/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
app: {{ $fullName }}
app.kubernetes.io/name: {{ $fullName }}
app.kubernetes.io/component: app
some-other-label: something
annotations:
{{- (tpl (toYaml .Values.ingress.annotations) .) | trim | nindent 4 }}
spec:
Expand Down
40 changes: 40 additions & 0 deletions create-diff-pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail

echo "directories"

mkdir base head

mv base-r/rendered-charts/* base/
mv head-r/rendered-charts/* head/

echo "diff"

diff -r base/ head/

DIFF=$(diff -r base/ head/)

echo "before if"

if [ -z "$DIFF" ]; then
cat <<'EOF' > pr.md
No changes detected in rendered charts.
EOF
else
echo "there are changes"
echo "${DIFF}"
cat <<'EOF' > pr.md
<details>
<summary>Rendered charts diff</summary>
This PR results in the following changes to rendered charts:

```diff
EOF
{
echo "$DIFF"
echo '```'
echo '</details>'
} >> pr.md
fi

gh pr comment "${PR_URL}" --create-if-none --edit-last --body-file pr.md
Loading