From 78513b3665af65bed5ee713415206ced3a96d214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DELAGE=20Rapha=C3=ABl?= <36408929+delager@users.noreply.github.com> Date: Tue, 11 Apr 2023 13:48:48 +0200 Subject: [PATCH] 1942 - Add Cloud Formation Linter check in CI (#2002) * #1942 Add CI for CloudFormation scripts - Add new CI for AWS CloudFormation scripts - Add label 'cfn-templates' on PR - Add syntax checking of cfn scripts using scottbrenner/cfn-lint-action * #1942 Remove schedule No schedule needed for this workflow * #1942 Add main branche Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com> --------- Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com> --- .github/workflows/aws-cfn-lint.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/aws-cfn-lint.yml diff --git a/.github/workflows/aws-cfn-lint.yml b/.github/workflows/aws-cfn-lint.yml new file mode 100644 index 000000000..11ed43317 --- /dev/null +++ b/.github/workflows/aws-cfn-lint.yml @@ -0,0 +1,36 @@ +name: Validate CloudFormation templates + +on: + pull_request: + branches: [ main, main-vnext ] + paths: + - 'templates/aws/**' + push: + branches: [ main, main-vnext ] + paths: + - 'templates/aws/**' + workflow_dispatch: + +jobs: + validate_cfn_templates: + name: Build and Validate CloudFormation Templates + runs-on: ubuntu-latest + + steps: + - name: Apply cfn-templates label on PR + uses: actions/github-script@v6 + if: ${{ github.event_name == 'pull_request' }} + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['cfn-templates'] + }) + - uses: actions/checkout@v3.4.0 + + - name: Check CloudFormation Syntax + uses: scottbrenner/cfn-lint-action@v2 + with: + path: templates/aws/ \ No newline at end of file