Interview questions and model answers
"How do you authenticate GitHub Actions to AWS?"
With OIDC, no stored keys. An IAM OIDC provider for GitHub's token issuer and a role whose trust policy allows AssumeRoleWithWebIdentity only for a specific repository and branch or environment, by matching the sub claim. The workflow grants id-token: write and uses configure-aws-credentials to get short-lived credentials. I use separate least-privilege roles per environment, with production tied to the protected production environment.
"pull_request vs pull_request_target?"
pull_request runs in the PR's context — for forks, without secrets and with a read-only token — so it's safe for building untrusted code. pull_request_target runs in the base repository's context with secrets and write permissions; checking out and running PR code there lets an attacker steal secrets. I only use it for metadata tasks like labelling, never to execute PR code.
"How do you share pipelines across 50 repositories?"
Reusable workflows in a central platform repository, versioned with tags, called with uses: org/repo/.github/workflows/x.yml@v3, plus composite actions for repeated step groups. Each repo's workflow is a few lines with inputs. Changes ship as new versions with changelogs; Dependabot or Renovate bump consumers.
"How do you secure GitHub Actions?"
Least-privilege permissions with a read-only default token, OIDC instead of static cloud keys, third-party actions pinned to commit SHAs from an allow-list, untrusted input passed via env variables to avoid script injection, no pull_request_target with PR code, environments with required reviewers and scoped secrets for production, ephemeral self-hosted runners never used by public repos, CODEOWNERS on workflow files, and linting with actionlint, zizmor and Scorecard.
"How would you speed up a slow Actions pipeline?"
Measure job and step timings first. Then cache dependencies with setup-* caching or actions/cache, use Docker layer caching with the gha or registry backend, parallelise with jobs and matrices, add path filters and concurrency cancellation, use larger runners or ARC for heavy builds, and split slow test suites.
"Composite action vs reusable workflow?"
A composite action packages steps that run inside the caller's job on its runner. A reusable workflow packages whole jobs with their own runners, permissions and environments. Composite for shared setup steps; reusable workflows for standard pipelines.
"Your self-hosted runners run on EKS — how do you set that up safely?"
Actions Runner Controller with runner scale sets: ephemeral runner pods that autoscale with queued jobs, in a dedicated namespace and node pool, with IRSA or Pod Identity giving only the AWS permissions those workflows need, restricted to specific repositories through runner groups, never used by public repos, and egress controls on the namespace.