|
| 1 | +# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-general-formatting-task.md |
| 2 | +name: Check General Formatting |
| 3 | + |
| 4 | +# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows |
| 5 | +on: |
| 6 | + push: |
| 7 | + pull_request: |
| 8 | + schedule: |
| 9 | + # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to tools. |
| 10 | + - cron: "0 8 * * TUE" |
| 11 | + workflow_dispatch: |
| 12 | + repository_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + check: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Set environment variables |
| 20 | + run: | |
| 21 | + # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable |
| 22 | + echo "EC_INSTALL_PATH=${{ runner.temp }}/editorconfig-checker" >> "$GITHUB_ENV" |
| 23 | +
|
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v2 |
| 26 | + |
| 27 | + - name: Install Task |
| 28 | + uses: arduino/setup-task@v1 |
| 29 | + with: |
| 30 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + version: 3.x |
| 32 | + |
| 33 | + - name: Download latest editorconfig-checker release binary package |
| 34 | + id: download |
| 35 | + uses: MrOctopus/download-asset-action@1.0 |
| 36 | + with: |
| 37 | + repository: editorconfig-checker/editorconfig-checker |
| 38 | + excludes: prerelease, draft |
| 39 | + asset: linux-amd64.tar.gz |
| 40 | + target: ${{ env.EC_INSTALL_PATH }} |
| 41 | + |
| 42 | + - name: Install editorconfig-checker |
| 43 | + run: | |
| 44 | + cd "${{ env.EC_INSTALL_PATH }}" |
| 45 | + tar --extract --file="${{ steps.download.outputs.name }}" |
| 46 | + # Give the binary a standard name |
| 47 | + mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec" |
| 48 | + # Add installation to PATH: |
| 49 | + # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path |
| 50 | + echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH" |
| 51 | +
|
| 52 | + - name: Check formatting |
| 53 | + run: task --silent general:check-formatting |
0 commit comments