summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijayakumar A <36878324+kumvijaya@users.noreply.github.com>2024-09-06 01:05:34 +0530
committerGitHub <noreply@github.com>2024-09-06 01:05:34 +0530
commitfad18d17d0146ab2026c2c5ad7551ef535528003 (patch)
tree2fa38cd7225a31bfda202e566996839b7687c098
parent1cb569f657641fb63e27db641cc148959f0273fd (diff)
downloadvyos-workflow-test-temp-fad18d17d0146ab2026c2c5ad7551ef535528003.tar.gz
vyos-workflow-test-temp-fad18d17d0146ab2026c2c5ad7551ef535528003.zip
test
-rw-r--r--.github/workflows/ruff-lint-2.yml56
-rw-r--r--.github/workflows/ruff-lint.yml31
2 files changed, 28 insertions, 59 deletions
diff --git a/.github/workflows/ruff-lint-2.yml b/.github/workflows/ruff-lint-2.yml
deleted file mode 100644
index 1c5d54e..0000000
--- a/.github/workflows/ruff-lint-2.yml
+++ /dev/null
@@ -1,56 +0,0 @@
----
-name: Ruff Lint 2
-
-on:
- pull_request:
- branches:
- - current
-
-permissions:
- pull-requests: write
- contents: read
-
-jobs:
- ruff-lint-2:
- runs-on: ubuntu-latest
- permissions:
- pull-requests: write
- contents: read
- steps:
- - name: Checkout reusable actions repo
- uses: actions/checkout@v3
- with:
- repository: vyos/.github
- path: reusable-actions
- ref: current
-
- - name: Checkout head
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- fetch-tags: true
- ref: ${{ github.event.pull_request.head.ref }}
- repository: ${{ github.event.pull_request.head.repo.full_name }}
- path: repo
-
- - name: Fetch base
- run: |
- cd repo
- git fetch https://github.com/${{ github.event.pull_request.base.repo.full_name }} ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/base
-
- - name: Setup python
- uses: actions/setup-python@v5
- with:
- python-version: '3.11'
-
- - name: Get changed files
- id: changed-files
- run: |
- cd repo
- git diff --name-only origin/base...${{ github.event.pull_request.head.ref }} > changed_files.txt
-
- - name: Run ruff on changed files
- uses: ChartBoost/ruff-action@v1
- with:
- files: |
- $(cat repo/changed_files.txt) \ No newline at end of file
diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml
index 4a87521..e84f5a2 100644
--- a/.github/workflows/ruff-lint.yml
+++ b/.github/workflows/ruff-lint.yml
@@ -6,10 +6,35 @@ on: pull_request
jobs:
ruff-lint:
runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+ contents: read
steps:
- - uses: actions/checkout@v4
+ - name: Checkout head
+ uses: actions/checkout@v4
with:
fetch-depth: 0
- - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b
+ ref: ${{ github.event.pull_request.head.ref }}
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
+
+ - name: Setup python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+
+ - name: Fetch base ruff config
+ run: |
+ git fetch https://github.com/${{ github.event.pull_request.base.repo.full_name }} ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/base
+ if git ls-tree -r origin/base --name-only | grep -q '^ruff.toml$'; then
+ git checkout origin/base -- ruff.toml
+ echo "Using ruff.toml from base repo"
+ cat ruff.toml
+ else
+ echo "No ruff.toml found in base repo"
+ fi
+
+ - name: Lint
+ uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b
with:
- changed-files: 'true'
+ args: 'format --check'
+ changed-files: 'true' \ No newline at end of file