ci(lint): keep the job token away from renovate.json and pin image lines in place
The renovate-config job clones in its own step and validates in a second step, so the job token is not in the environment that reads the pull request's renovate.json. check_bot_pr_diff.py now refuses a moved image line in every workflow whose pins a bot may move, lint.yml included, not only in image.yml and renovate.yml. Tests cover a moved lint.yml line, an added second Renovate line and a changed indentation. Refs: #188 Assisted-by: Claude Code
This commit is contained in:
1 parent
076546f91b
commit
9fb3cbd4fd
3 files changed
+34
-14
No files matched your search
@@ -157,8 +157,8 @@ jobs:
|
||||
container:
|
||||
image: renovate/renovate:44.161.0-full@sha256:ddbf02e44b542343c9df696b88fd953f04cc3ee5f771221805ff8efb26595416
|
||||
steps:
|
||||
# The image runs as a non-root user, so the clone goes to a directory it owns.
|
||||
- name: Validate renovate.json
|
||||
# The image runs as a non-root user, so the clone goes to the runner's temp directory.
|
||||
- name: Checkout the commit under test
|
||||
env:
|
||||
GIT_CONFIG_COUNT: "1"
|
||||
GIT_CONFIG_KEY_0: http.extraheader
|
||||
@@ -167,10 +167,15 @@ jobs:
|
||||
REF: ${{ github.ref }}
|
||||
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
|
||||
run: |
|
||||
src="$(mktemp -d)"
|
||||
src="${RUNNER_TEMP:-/tmp}/renovate-config"
|
||||
git clone "$REPO_URL" "$src"
|
||||
cd "$src"
|
||||
git checkout "$SHA" || { git fetch origin "$REF" && git checkout "$SHA"; }
|
||||
echo "Checked out $(git rev-parse HEAD)"
|
||||
# --no-global: renovate.json is a repository config, not the bot's global one.
|
||||
|
||||
# A step of its own, so the job token is not in the environment that reads renovate.json.
|
||||
# --no-global: renovate.json is a repository config, not the bot's global one.
|
||||
- name: Validate renovate.json
|
||||
run: |
|
||||
cd "${RUNNER_TEMP:-/tmp}/renovate-config"
|
||||
renovate-config-validator --strict --no-global renovate.json
|
||||
Reference in new issue
Block a user