From 999d6295b9b40aa6894654da2c9236ffb86992af Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Thu, 5 Sep 2024 23:27:17 +0200 Subject: [PATCH] Lint templates before sync --- .github/workflows/ci.yaml | 30 ++++++++++++++++++++++++++++++ .github/workflows/sync.yaml | 16 ---------------- 2 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/sync.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..6e5060f --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + +jobs: + lint: + name: Lint Jinja Templates + runs-on: ubuntu-latest + steps: + - name: Checkout git repo + uses: actions/checkout@v4 + + - name: Run j2lint + uses: ansible-actions/j2lint-action@v0.0.1 + with: + target: "*.j2" + + sync: + name: Netbox Sync + runs-on: ubuntu-latest + if: github.ref_name == 'main' + needs: lint + env: + DATA_SOURCE_ID: "1" + steps: + - run: | + curl https://netbox.freifunk-duesseldorf.de/api/core/data-sources/${DATA_SOURCE_ID}/sync/ \ + -X POST --fail \ + -H "Authorization: Token ${{ secrets.NETBOX_API_TOKEN }}" diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml deleted file mode 100644 index b39884d..0000000 --- a/.github/workflows/sync.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: Netbox Sync -on: - push: - branches: [main] - -jobs: - trigger: - name: Trigger - runs-on: ubuntu-latest - env: - DATA_SOURCE_ID: "1" - steps: - - run: | - curl https://netbox.freifunk-duesseldorf.de/api/core/data-sources/${DATA_SOURCE_ID}/sync/ \ - -X POST --fail \ - -H "Authorization: Token ${{ secrets.NETBOX_API_TOKEN }}"