This action generates a diff between the current PR and the current state of the cluster.
Note that this includes any changes between your branch and latest master
, as well as ways in which the cluster is out of sync.
Example GH action:
name: ArgoCD Diff
on:
pull_request:
branches: [master, main]
jobs:
argocd-diff:
name: Generate ArgoCD Diff
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: quizlet/argocd-diff-action@master
name: ArgoCD Diff
with:
argocd-server-url: argocd.example.com
argocd-token: ${{ secrets.ARGOCD_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
argocd-version: v1.6.1
argocd-extra-cli-args: --grpc-web # optional
app-name-matcher: "/^myapp-/" # optional
plaintext: true # optional
environment: myenv # optional
- Downloads the specified version of the ArgoCD binary, and makes it executable
- Connects to the ArgoCD API using the
argocd-token
, and gets all the apps - Filters the apps to the ones that live in the current repo
- Runs
argocd app diff
for each app - Posts the diff output as a comment on the PR
Build the script and commit to your branch:
npm run build && npm run pack
Commit the build output, and make a PR.