Skip to content

Commit

Permalink
ci: run argocd diff on app-of-apps on pull requests
Browse files Browse the repository at this point in the history
Add a GitHub Actions workflow that runs `argocd app diff` on the
app-of-apps application when a pull request is opened or updated.
  • Loading branch information
d3adb5 committed Apr 6, 2024
1 parent 2d4ce79 commit f00a4e4
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Argo CD

on:
pull_request:
branches:
- master

jobs:
diff:
name: Differences
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: clowdhaus/argo-cd-action@v2.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
command: version
options: --client
- name: Gather differences in the app of apps
env:
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_AUTH_TOKEN }}
run: |
echo '```diff' > diff.txt
set +e -o pipefail
argocd app diff app-of-apps --revision ${{ github.sha }} \
--server ${{ vars.ARGOCD_SERVER }} --grpc-web | tee -a diff.txt
status="$?"
echo '```' >> diff.txt
set -e
if [ "$status" -ne 0 ] && [ "$status" -ne 1 ]; then
echo "A failure happened while running the app diff command." > diff.txt
exit 1
elif [ "$status" -eq 0 ]; then
echo "No differences found in the app of apps." > diff.txt
fi
- name: Comment results on the pull request
uses: thollander/actions-comment-pull-request@v2
with:
filePath: diff.txt

0 comments on commit f00a4e4

Please sign in to comment.