Skip to content

[v2] Github action fixes - #3673

Merged
EmilienM merged 12 commits into
gophercloud:v2from
shiftstack:gha-fixes-v2
Apr 1, 2026
Merged

EmilienM merged 12 commits into
gophercloud:v2from
shiftstack:gha-fixes-v2

Conversation

@mandre

@mandre mandre commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Backport relevant changes from #3659 and #3666 to v2 branch.

mandre added 12 commits March 31, 2026 16:26
The condition was comparing the string representations of two
separate expression expansions with a literal == operator, which
always evaluates to true in GitHub Actions. Move the comparison
inside a single expression to perform an actual equality check.

Reported by zizmor (excessive-permissions / unpinned-uses were
flagged on the same pass).
Prevent the GITHUB_TOKEN from being persisted in the local git
config after checkout. This limits the blast radius if a
subsequent step is compromised, since the token will not be
available through the git credential helper.

Reported by zizmor (artipacked).
Apply the principle of least privilege by adding explicit permissions
blocks to every job that was relying on default (overly broad)
permissions. Each job now declares only the permissions it needs.

Reported by zizmor (excessive-permissions).
Replace ${{ env.* }} expressions in shell run blocks with native
shell variable references ($VAR), and pass ${{ github.base_ref }}
through an env variable instead of expanding it directly in a shell
command. This prevents potential code injection through template
expansion.

Reported by zizmor (template-injection).
Replace mutable version tags with immutable commit SHA references
for all GitHub Actions used in workflows. This prevents a
compromised or hijacked action tag from injecting malicious code
into CI runs.

Reported by zizmor (unpinned-uses).
The backport bot token action requires secrets to be passed through
the 'with' block (not environment variables) because it's a
composite action input. Add zizmor ignore comments to suppress the
false-positive warnings.

Reported by zizmor (secrets-outside-env).
This workflow only reads label metadata from the event payload and
does not need write access to the repository. Using pull_request
instead of pull_request_target avoids granting unnecessary elevated
privileges.

Reported by zizmor (dangerous-triggers).
The backport workflow legitimately uses pull_request_target because
it needs write access to create backport PRs. It is safe because it
only runs on merged PRs (guarded by an if condition) and never
checks out or executes PR code.

Reported by zizmor (dangerous-triggers).
Move the Go API compatibility analysis (semver check) into a
separate 'Semver analysis' workflow that runs on the unprivileged
pull_request trigger. The label-pr workflow now picks up the results
via a workflow_run trigger, which only fires after the analysis
completes. This eliminates the need for pull_request_target in the
semver analysis, removing the dangerous-triggers finding.

The semver-label job uses the GitHub API to look up the PR number
from the head commit SHA, then applies the appropriate semver and
backport labels.

Reported by zizmor (dangerous-triggers).
The commits/:sha/pulls API endpoint does not return results for
fork PRs because the commit does not exist in the base repository.
Instead, include the PR number and base ref in the artifact
uploaded by the semver analysis workflow, where they are always
available from the pull_request event context.

This fixes up commit 609db9c.
Dependabot reads its configuration from the default branch (main)
only. Having a copy on v2 is unnecessary and potentially confusing.
This workflow was already removed from the main branch. The
first-interaction greeting bot is no longer needed since the
repository now uses issue and PR templates to guide contributors.

This also resolves the last zizmor dangerous-triggers finding.
@github-actions github-actions Bot added edit:actions This PR updates GitHub Actions code v2 This PR targets v2 edit:testinfra This PR updates testing infrastructure code labels Mar 31, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 63.661%. remained the same
when pulling 63c0cce on shiftstack:gha-fixes-v2
into 1fb50c4 on gophercloud:v2.

@github-actions github-actions Bot added the semver:patch No API change label Mar 31, 2026
@EmilienM
EmilienM merged commit ca7ee49 into gophercloud:v2 Apr 1, 2026
65 of 66 checks passed
@mandre
mandre deleted the gha-fixes-v2 branch April 1, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

edit:actions This PR updates GitHub Actions code edit:testinfra This PR updates testing infrastructure code semver:patch No API change v2 This PR targets v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants