GitHub Actions interview questions

25 questions from the GitHub Actions course, each with the correct answer and an explanation. Try to answer before you open the answer.

GitHub Actions Fundamentals

1. Where are GitHub Actions workflows stored?

  1. Only in organisation settings
  2. In the repository wiki
  3. In .github/workflows/ in the repository
  4. In package.json
Show answer

Answer: In .github/workflows/ in the repository

Workflows are versioned with the code.

Lesson: What GitHub Actions Does

2. Do two jobs in the same workflow share files by default?

  1. No, each job runs on a fresh runner; use artifacts or outputs to pass data
  2. Yes, always
  3. Only on Windows runners
  4. Only if they have the same name
Show answer

Answer: No, each job runs on a fresh runner; use artifacts or outputs to pass data

Jobs are isolated.

Lesson: Anatomy of a Workflow

3. Why are self-hosted runners risky for public repositories?

  1. They do not support YAML
  2. They are slower
  3. They cannot run Linux
  4. Anyone can open a pull request that runs code on your machine
Show answer

Answer: Anyone can open a pull request that runs code on your machine

Untrusted code needs disposable runners.

Lesson: Runners

Triggers and Filters

4. Which trigger adds a manual "Run workflow" button?

  1. push
  2. workflow_dispatch
  3. schedule
  4. pull_request
Show answer

Answer: workflow_dispatch

Manual runs with inputs.

Lesson: Common Events

5. With paths [src/**, !**/*.md], does changing only src/README.md trigger the workflow?

  1. Yes, because it is under src/
  2. No, the later negation excludes Markdown files
  3. Only on Mondays
  4. Only for forks
Show answer

Answer: No, the later negation excludes Markdown files

Later patterns win.

Lesson: Branch and Path Filters

6. Which time zone do GitHub Actions cron schedules use?

  1. US Pacific time
  2. The repository owner's local time
  3. The runner's local time
  4. UTC
Show answer

Answer: UTC

Always UTC.

Lesson: Scheduled Workflows

Jobs, Steps and Data Flow

7. What is the difference between uses and run?

  1. uses runs a packaged action; run executes shell commands
  2. They are identical
  3. run only works on Windows
  4. uses only installs Node.js
Show answer

Answer: uses runs a packaged action; run executes shell commands

Actions versus scripts.

Lesson: Steps: uses and run

8. What happens to a job whose needs dependency failed?

  1. It retries forever
  2. It runs anyway
  3. It is skipped, unless its if condition uses a status function such as always()
  4. It deletes the workflow
Show answer

Answer: It is skipped, unless its if condition uses a status function such as always()

Dependencies gate execution.

Lesson: Job Dependencies With needs

9. How does one job read a value produced by another job?

  1. Through environment variables automatically
  2. Through a shared /tmp folder
  3. Through job outputs, via needs.<job>.outputs.<name>
  4. It cannot
Show answer

Answer: Through job outputs, via needs.<job>.outputs.<name>

Explicit outputs cross job boundaries.

Lesson: Outputs and Artifacts

Matrices, Expressions and Conditions

10. What does fail-fast: false change?

  1. Other matrix jobs keep running when one fails
  2. The matrix runs sequentially
  3. Failures are ignored
  4. Only the first combination runs
Show answer

Answer: Other matrix jobs keep running when one fails

See every result.

Lesson: Matrix Builds

11. When are ${{ }} expressions in a run: script evaluated?

  1. Only on Windows
  2. By the shell at runtime
  3. Never
  4. Before the shell runs the script, by GitHub Actions
Show answer

Answer: Before the shell runs the script, by GitHub Actions

Substitution happens first.

Lesson: Expressions and Contexts

12. Which status function runs a step even when earlier steps failed but not when the run is cancelled?

  1. success()
  2. !cancelled()
  3. always() only
  4. never()
Show answer

Answer: !cancelled()

Cleanup without running on cancellation.

Lesson: Conditional Steps and Jobs

Faster, Cheaper Pipelines

13. What should a dependency cache key usually include?

  1. The current time
  2. The OS and a hash of the lockfile
  3. A random number
  4. The workflow file name only
Show answer

Answer: The OS and a hash of the lockfile

Change the key exactly when dependencies change.

Lesson: Dependency Caching

14. What does cancel-in-progress: true do for a new run in the same group?

  1. Deletes the group
  2. Cancels the new run
  3. Runs both in parallel
  4. Cancels the older in-progress run
Show answer

Answer: Cancels the older in-progress run

Newest run wins.

Lesson: Concurrency Groups

15. What is the default job timeout?

  1. 6 hours
  2. 5 minutes
  3. 30 seconds
  4. There is no limit
Show answer

Answer: 6 hours

Set your own.

Lesson: Timeouts, Sizing and Splitting

Securing Workflows

16. What happens to unspecified scopes once you set permissions:?

  1. They keep the repository default
  2. They become write
  3. They are set to none
  4. The workflow fails to start
Show answer

Answer: They are set to none

Explicit allow-list.

Lesson: GITHUB_TOKEN Permissions

17. How should an issue title be used in a run: script?

  1. Inside eval
  2. Directly as ${{ github.event.issue.title }} in the script
  3. Through an environment variable, referenced as "$TITLE"
  4. Base64 decoded and executed
Show answer

Answer: Through an environment variable, referenced as "$TITLE"

Data in env, not in code.

Lesson: Script Injection From Untrusted Input

18. Why pin actions to a commit SHA instead of a tag?

  1. Tags can be moved to different code; a SHA always refers to the same code
  2. SHAs run faster
  3. Tags are not allowed
  4. SHAs include secrets
Show answer

Answer: Tags can be moved to different code; a SHA always refers to the same code

Immutable references.

Lesson: Pinning Third-Party Actions

19. What advantage does OIDC give over storing cloud keys as secrets?

  1. No need for permissions
  2. Faster builds
  3. Free cloud usage
  4. Short-lived credentials with no long-lived key to leak
Show answer

Answer: Short-lived credentials with no long-lived key to leak

Federation instead of static keys.

Lesson: Secrets and OIDC

Reuse and Deployment

20. Which trigger makes a workflow callable by other workflows?

  1. workflow_dispatch
  2. workflow_call
  3. repository_dispatch
  4. push
Show answer

Answer: workflow_call

Reusable workflows are called as jobs.

Lesson: Reusable Workflows

21. When is a composite action a better fit than a reusable workflow?

  1. When reusing whole multi-job pipelines
  2. When reusing a sequence of steps inside jobs
  3. When you need a cron schedule
  4. Never
Show answer

Answer: When reusing a sequence of steps inside jobs

Steps versus jobs.

Lesson: Composite Actions

22. What can an environment protection rule require?

  1. A different YAML syntax
  2. A faster runner
  3. A larger cache
  4. Approval from designated reviewers before the job runs
Show answer

Answer: Approval from designated reviewers before the job runs

Human gates for sensitive deploys.

Lesson: Environments, Approvals and Releases

Linting, Debugging and a Checklist

23. Which mistake can actionlint catch without running the workflow?

  1. A needs: reference to a job that does not exist
  2. A failing unit test
  3. A slow network
  4. An expired cloud credential
Show answer

Answer: A needs: reference to a job that does not exist

Static analysis of workflow files.

Lesson: Linting Workflows With actionlint

24. How do you enable more detailed step logs?

  1. Increase the timeout
  2. Delete the workflow
  3. Set ACTIONS_STEP_DEBUG to true or re-run with debug logging
  4. Use a macOS runner
Show answer

Answer: Set ACTIONS_STEP_DEBUG to true or re-run with debug logging

Debug logging on demand.

Lesson: Debugging Failing Runs

25. Which item belongs on a GitHub Actions review checklist?

  1. Write-all token permissions by default
  2. Self-hosted runners for public repositories
  3. Third-party actions pinned to full commit SHAs
  4. Issue titles inserted directly into run scripts
Show answer

Answer: Third-party actions pinned to full commit SHAs

Least privilege and immutable dependencies.

Lesson: A GitHub Actions Review Checklist

← Back to the course