Skip to content

NEED REVIEW : Correct workflow yml files - #123

Open
MykolaMS9 wants to merge 1 commit into
rust-lang-ua:masterfrom
MykolaMS9:runner-change-name
Open

NEED REVIEW : Correct workflow yml files#123
MykolaMS9 wants to merge 1 commit into
rust-lang-ua:masterfrom
MykolaMS9:runner-change-name

Conversation

@MykolaMS9

Copy link
Copy Markdown

Task

Update GitHub Actions workflows to:

  • Add the ability to choose a custom (e.g. self-hosted) runner label instead of the hardcoded ubuntu-latest.
  • Pin all third-party actions to a specific commit SHA instead of a mutable version tag, to protect against supply-chain attacks (a tag can be moved to point at different, possibly malicious, code).

Solution

  • Replaced runs-on: ubuntu-latest with runs-on: ${{ vars.GH_RUNNER_LABEL_CI || 'ubuntu-latest' }} in ci.yml, students_ci.yml and students_tool_cache.yml. This lets CI switch to a custom runner by setting the GH_RUNNER_LABEL_CI repository/organization variable, while still defaulting to ubuntu-latest when it's not set (GitHub Actions expressions treat an unset vars.* as an empty, falsy string, so || works as a default-value operator here).
  • Pinned every uses: action reference to its full commit SHA, with a # <version> comment for readability:
    • actions/checkout@v3/@v4@9c091bb... (v7.0.0)
    • gaurav-nelson/github-action-markdown-link-check@v1@3c3b66f... (1.0.17) — the v1 tag turned out to be frozen on a 2022 commit and no longer tracks the maintainer's actual releases.
    • Swatinem/rust-cache@v2@e18b497... (v2.9.1)
  • Replaced actions-rs/toolchain@v1 with dtolnay/rust-toolchain (pinned to SHA), because the actions-rs GitHub org was archived in October 2023 and the action is unmaintained (relies on deprecated Node.js runtimes). Updated the dependent cache key from steps.rust.outputs.rustc_hash to steps.rust.outputs.cachekey, since the new action exposes the cache key under a different output name.

- change runs-on value: add possibility to chose custom runner label
- add sha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant