Skip to content

Commit 2fab431

Browse files
committed
Simplify if conditions and use hash of actions instead of version
1 parent 563c861 commit 2fab431

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

.github/workflows/backend.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
backend-lint:
4242
runs-on: "ubuntu-latest"
4343
needs: [backend-changes]
44-
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (contains(fromJSON('["pull_request", "merge_group"]'), github.event_name) && needs.backend-changes.outputs.changes == 'true') }}
44+
if: ${{ (github.event_name == 'push') || (needs.backend-changes.outputs.changes == 'true') }}
4545
permissions:
4646
contents: read
4747
steps:
@@ -66,7 +66,7 @@ jobs:
6666
backend-lockfiles:
6767
runs-on: "ubuntu-latest"
6868
needs: [backend-changes]
69-
if: ${{ (contains(fromJSON('["pull_request", "merge_group"]'), github.event_name) && needs.backend-changes.outputs.changes == 'true') }}
69+
if: ${{ (contains(fromJSON('["pull_request", "merge_group"]'), github.event_name)) && (needs.backend-changes.outputs.changes == 'true') }}
7070
permissions:
7171
contents: read
7272
steps:
@@ -89,7 +89,7 @@ jobs:
8989
9090
backend-test:
9191
needs: [backend-changes]
92-
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (contains(fromJSON('["pull_request", "merge_group"]'), github.event_name) && needs.backend-changes.outputs.changes == 'true') }}
92+
if: ${{ (github.event_name == 'push') || (needs.backend-changes.outputs.changes == 'true') }}
9393
strategy:
9494
fail-fast: false
9595
matrix:

.github/workflows/sphinx.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
sphinx-version:
8787
runs-on: ubuntu-latest
8888
needs: [sphinx-changes]
89-
if: ${{ (! contains(fromJSON('["pull_request", "merge_group"]'), github.event_name)) || needs.sphinx-changes.outputs.changes == 'true' }}
89+
if: ${{ (contains(fromJSON('["push", "release"]'), github.event_name)) || (needs.sphinx-changes.outputs.changes == 'true') }}
9090
outputs:
9191
SPHINX_VERSION: ${{ steps.sphinx-version.outputs.SPHINX_VERSION }}
9292
SPHINX_RELEASE: ${{ steps.sphinx-version.outputs.SPHINX_RELEASE }}
@@ -112,12 +112,12 @@ jobs:
112112
sphinx-build:
113113
runs-on: ubuntu-latest
114114
needs: [sphinx-version]
115-
if: ${{ (! contains(fromJSON('["pull_request", "merge_group"]'), github.event_name)) || needs.sphinx-changes.outputs.changes == 'true' }}
115+
if: ${{ (contains(fromJSON('["push", "release"]'), github.event_name)) || (needs.sphinx-changes.outputs.changes == 'true') }}
116116
steps:
117-
- uses: actions/checkout@v4
117+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
118118
with:
119119
lfs: 'true'
120-
- uses: actions/setup-python@v5
120+
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
121121
with:
122122
python-version: '3.12'
123123
cache: 'pip'
@@ -127,21 +127,21 @@ jobs:
127127
SPHINX_VERSION: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }}
128128
SPHINX_RELEASE: ${{ needs.sphinx-version.outputs.SPHINX_RELEASE }}
129129
SPHINX_DOMAIN: ${{ vars.DOCUMENTATION_DOMAIN }}
130-
- uses: actions/upload-artifact@v4
130+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
131131
with:
132132
name: sphinx-html-artifact
133133
path: sphinx/build/html/
134134

135135
sphinx-deploy-html:
136-
if: ${{ (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
136+
if: ${{ (contains(fromJSON('["push", "release"]'), github.event_name)) }}
137137
runs-on: ubuntu-latest
138138
needs: [sphinx-version, sphinx-build]
139139
steps:
140140
- name: Checkout code
141-
uses: actions/checkout@v4
141+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
142142

143143
- name: Download HTML artifacts
144-
uses: actions/download-artifact@v4
144+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
145145
with:
146146
name: sphinx-html-artifact
147147
path: html/
@@ -171,7 +171,7 @@ jobs:
171171
runs-on: ubuntu-latest
172172
needs: [sphinx-version, sphinx-build, sphinx-deploy-html]
173173
steps:
174-
- uses: actions/checkout@v4
174+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
175175
- shell: python
176176
run: |
177177
import os
@@ -251,7 +251,7 @@ jobs:
251251
if: ${{ always() && (github.event_name != 'pull_request') }}
252252
needs: [sphinx-version, sphinx-build, sphinx-deploy-html, sphinx-deploy-root-files]
253253
steps:
254-
- uses: geekyeggo/delete-artifact@v5
254+
- uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
255255
with:
256256
name: sphinx-html-artifact
257257

0 commit comments

Comments
 (0)