chore(deps): update ghcr.io/walnuts1018/walnuts.dev docker tag to f6b76e0fab016adf3cfb17b0d124f2bb5e6b20fe-388 #709
Workflow file for this run
This file contains 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: Check Snapshot Diff | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: setup-go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "scripts/infrautil/go.mod" | |
cache-dependency-path: "scripts/infrautil/go.sum" | |
- name: make snapshot | |
run: | | |
make snapshot | |
mv k8s/snapshots /tmp/snapshots-head | |
- name: Check out snapshot branch | |
uses: actions/checkout@v4 | |
with: | |
ref: snapshot | |
- name: mv | |
run: | | |
mkdir /tmp/snapshots-main | |
mv k8s/apps /tmp/snapshots-main/apps | |
mv k8s/helm /tmp/snapshots-main/helm | |
- name: Upload folder | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: manifests | |
path: | | |
/tmp/snapshots-head | |
/tmp/snapshots-main | |
diff: | |
runs-on: ubuntu-latest | |
needs: generate | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: manifests | |
- name: Build markdown comment with manifest diff | |
run: | | |
echo "# Manifest (k8s/apps) diff | |
<details> | |
<summary>Click to expand</summary> | |
\`\`\`diff | |
$(for f in $(find snapshots-head/apps -type f); do diff -u $(echo $f | sed 's/head/main/') $f; done) | |
\`\`\` | |
</details>" | tee /tmp/diff.md | |
# PRへのコメントだけど、issue commentのAPIを使うらしい | |
- name: Comment manifest diff to GitHub PR | |
continue-on-error: true | |
run: | | |
cat /tmp/diff.md | jq -Rs '{ "body": . }' | curl --fail \ | |
-X POST -H 'Accept: application/vnd.github.v3+json' \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments \ | |
-d @- | |
- name: Build markdown comment with helm diff | |
run: | | |
echo "# Helm diff | |
<details> | |
<summary>Click to expand</summary> | |
\`\`\`diff | |
$(for f in $(find snapshots-head/helm -type f); do diff -u $(echo $f | sed 's/head/main/') $f; done) | |
\`\`\` | |
</details>" | tee /tmp/diff.md | |
# PRへのコメントだけど、issue commentのAPIを使うらしい | |
- name: Comment manifest diff to GitHub PR | |
continue-on-error: true | |
run: | | |
cat /tmp/diff.md | jq -Rs '{ "body": . }' | curl --fail \ | |
-X POST -H 'Accept: application/vnd.github.v3+json' \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments \ | |
-d @- |