Skip to content

[StepSecurity] ci: Harden GitHub Actions #1688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/build-sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}

Expand All @@ -52,7 +52,7 @@ jobs:
echo "$GITHUB_CONTEXT"

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
docker-images: false

Expand Down Expand Up @@ -86,13 +86,13 @@ jobs:
sudo apt-get install -y nvidia-cuda-toolkit clinfo

- name: Checkout repo
uses: actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

# https://github.com/marketplace/actions/setup-miniconda
- name: Setup miniconda
uses: conda-incubator/[email protected]
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
auto-update-conda: true
python-version: ${{ env.python-ver }}
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:

# https://github.com/marketplace/actions/doxygen-action
- name: Build backend docs
uses: mattnotmitt/[email protected]
uses: mattnotmitt/doxygen-action@cbe72c8e402e8a3faa1f0b247ef90aa6c8e4ce74 # v1.9.8
with:
working-directory: 'dpnp/backend/doc'

Expand All @@ -146,7 +146,7 @@ jobs:
# The step is only used to build docs while pushing a PR to "master"
- name: Deploy docs
if: env.GH_EVENT_PUSH_UPSTREAM
uses: peaceiris/[email protected]
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.PUBLISH_DIR }}
Expand All @@ -159,7 +159,7 @@ jobs:
# The step is only used to build docs while pushing to PR branch
- name: Publish pull-request docs
if: env.GH_EVENT_OPEN_PR_UPSTREAM
uses: peaceiris/[email protected]
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.PUBLISH_DIR }}
Expand All @@ -176,7 +176,7 @@ jobs:
if: env.GH_EVENT_OPEN_PR_UPSTREAM
env:
PR_NUM: ${{ github.event.number }}
uses: mshick/[email protected]
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
with:
message: |
View rendered docs @ https://intelpython.github.io/dpnp/pull/${{ env.PR_NUM }}/index.html
Expand All @@ -199,7 +199,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/[email protected]
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

Expand All @@ -218,7 +218,7 @@ jobs:
git push tokened_docs gh-pages

- name: Modify the comment with URL to official documentation
uses: mshick/[email protected]
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
with:
find: |
View rendered docs @.+
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ jobs:

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout DPNP repo
uses: actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Setup miniconda
uses: conda-incubator/[email protected]
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
Expand All @@ -105,7 +105,7 @@ jobs:
run: conda install conda-build=3.28.4

- name: Cache conda packages
uses: actions/cache@v4
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
Expand All @@ -120,7 +120,7 @@ jobs:
run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe

- name: Upload artifact
uses: actions/[email protected]
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:

steps:
- name: Download artifact
uses: actions/[email protected]
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.pkg-path-in-channel }}
Expand All @@ -164,7 +164,7 @@ jobs:
tar -xvf ${{ env.pkg-path-in-channel }}/${{ env.PACKAGE_NAME }}-*.tar.bz2 -C ${{ env.extracted-pkg-path }}

- name: Setup miniconda
uses: conda-incubator/[email protected]
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'

- name: Cache conda packages
uses: actions/cache@v4
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:

steps:
- name: Download artifact
uses: actions/[email protected]
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.pkg-path-in-channel }}
Expand All @@ -274,7 +274,7 @@ jobs:
dir ${{ env.extracted-pkg-path }}

- name: Setup miniconda
uses: conda-incubator/[email protected]
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
Expand Down Expand Up @@ -320,7 +320,7 @@ jobs:
run: more lockfile

- name: Cache conda packages
uses: actions/cache@v4
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
Expand Down Expand Up @@ -388,12 +388,12 @@ jobs:

steps:
- name: Download artifact
uses: actions/[email protected]
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}

- name: Setup miniconda
uses: conda-incubator/[email protected]
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
Expand All @@ -416,7 +416,7 @@ jobs:
run:
shell: bash -el {0}
steps:
- uses: conda-incubator/[email protected]
- uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
run-post: false
channel-priority: "disabled"
Expand All @@ -427,7 +427,7 @@ jobs:
run: conda install anaconda-client

- name: Checkout repo
uses: actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: IntelPython/devops-tools
fetch-depth: 0
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/generate_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ jobs:

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout repo
uses: actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Setup miniconda
uses: conda-incubator/[email protected]
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
auto-update-conda: true
python-version: ${{ env.python-ver }}
Expand All @@ -60,7 +60,7 @@ jobs:

- name: Build dpnp with coverage
id: build_coverage
uses: nick-fields/[email protected]
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
shell: bash
timeout_minutes: 60
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/openssf-scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/[email protected]
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif
Expand All @@ -60,14 +60,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/[email protected]
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: SARIF file
path: results.sarif
retention-days: 14

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/[email protected]
uses: github/codeql-action/upload-sarif@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3.24.0
with:
sarif_file: results.sarif
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
sudo ln -s /usr/bin/clang-format-12 /usr/bin/clang-format
clang-format --version

- uses: actions/[email protected]
- uses: actions/setup-python@v5
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: '3.11'
- uses: pre-commit/[email protected]
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0