Chaemin2001/social login #676
Workflow file for this run
This file contains 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: Lint | |
on: | |
pull_request: | |
paths: | |
- ".github/workflows/lint.yml" | |
- "**.swift" | |
- ".swiftlint.yml" | |
- ".swiftformat" | |
jobs: | |
format: | |
name: SwiftFormat | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Print current branch name | |
run: | | |
echo ${{ github.ref_name }} | |
git log -1 | |
- run: | | |
echo ${{ github.event.pull_request.head.sha }} | |
echo ${{ github.event.pull_request.base.sha }} | |
- name: Get list changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v17 | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
base_sha: ${{ github.event.pull_request.base.sha }} | |
separator: "," | |
files: | | |
**/*.swift | |
- name: Install SwiftFormat | |
run: brew install swiftformat | |
- name: Format Swift code | |
run: | | |
string='${{ steps.changed-files.outputs.all_changed_files }}' | |
IFS=, read -r -a files <<<"$string" | |
swiftformat --verbose "${files[@]}" --config .swiftformat | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Apply SwiftFormat changes | |
lint: | |
name: SwiftLint | |
runs-on: ubuntu-latest | |
needs: format | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: SwiftLint | |
uses: norio-nomura/[email protected] | |
env: | |
DIFF_BASE: ${{ github.base_ref }} # only files changed in the PR |