From 4178693e633aa57ccfda0267e4c0b0006d82ca75 Mon Sep 17 00:00:00 2001 From: Jacques ROUSSEL Date: Fri, 28 Mar 2025 11:40:17 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(ci)=20use=20github=20action=20for?= =?UTF-8?q?=20argocd=20webhook=20notification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to refactor this notification between alls projetcs, we choose to use a custom github action --- .github/workflows/docker-hub.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-hub.yml b/.github/workflows/docker-hub.yml index 9321a1ee..196a3f0e 100644 --- a/.github/workflows/docker-hub.yml +++ b/.github/workflows/docker-hub.yml @@ -127,12 +127,9 @@ jobs: runs-on: ubuntu-latest if: github.event_name != 'pull_request' steps: - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Call argocd github webhook - run: | - data='{"ref": "'$GITHUB_REF'","repository": {"html_url":"'$GITHUB_SERVER_URL'/${{ secrets.DEPLOYMENT_REPO_URL }}"}}' - sig=$(echo -n ${data} | openssl dgst -sha256 -hmac "${{ secrets.ARGOCD_PREPROD_WEBHOOK_SECRET }}" | awk '{print "X-Hub-Signature-256: sha256="$2}') - curl -X POST -H 'X-GitHub-Event:push' -H "Content-Type: application/json" -H "${sig}" --data "${data}" ${{ vars.ARGOCD_PREPROD_WEBHOOK_URL }} \ No newline at end of file + - uses: numerique-gouv/action-argocd-webhook-notification@main + id: notify + with: + deployment_repo_path: "${{ secrets.DEPLOYMENT_REPO_URL }}" + argocd_webhook_secret: "${{ secrets.ARGOCD_PREPROD_WEBHOOK_SECRET }}" + argocd_url: "${{ vars.ARGOCD_PREPROD_WEBHOOK_URL }}"