Add the ability to run Dockerfile based containers (non-Swift!) #261
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Swift Format Check and Fix | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
format-check: | |
name: Swift Format Check | |
runs-on: ubuntu-latest | |
container: swift:6.1.0 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Run Swift Format Check | |
id: format_check | |
run: swift format lint --recursive --strict Sources | |
continue-on-error: true | |
- name: Fix Formatting Issues | |
if: steps.format_check.outcome != 'success' | |
run: swift format --recursive --in-place Sources | |
- name: Comment on PR | |
if: steps.format_check.outcome != 'success' | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `## Swift Format Check Failed | |
The Swift formatter found issues with your code. Please run the following command to fix them: | |
\`\`\` | |
swift format --recursive --in-place Sources | |
\`\`\` | |
Then commit and push the changes.` | |
}); |