0
0
Gitdevops~20 mins

GitHub Actions basics - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
GitHub Actions Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Output of a GitHub Actions workflow run command
What is the output of the following GitHub Actions command when triggered in a workflow?
Git
echo "Hello from GitHub Actions!"
AHello from GitHub Actions!
Becho Hello from GitHub Actions!
CError: command not found
DNo output
Attempts:
2 left
💡 Hint
Think about what the echo command does in a shell environment.
🧠 Conceptual
intermediate
1:30remaining
Understanding GitHub Actions workflow triggers
Which event triggers a GitHub Actions workflow when a pull request is opened?
Apull_request
Brelease
Cpush
Dissue_comment
Attempts:
2 left
💡 Hint
Think about the event name that relates to pull requests.
Configuration
advanced
2:00remaining
Correct syntax for a GitHub Actions job with multiple steps
Which option shows the correct YAML syntax for a job named 'build' with two steps: one to checkout code and one to run a script?
Git
name: CI
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
A
- uses: actions/checkout@v3
  - run: ./build.sh
B
steps:
  - uses: actions/checkout@v3
  - run: ./build.sh
C
- uses: actions/checkout@v3
    - run: ./build.sh
D
- uses: actions/checkout@v3
- run: ./build.sh
Attempts:
2 left
💡 Hint
Remember that each step is an item in a list with a dash and proper indentation.
Troubleshoot
advanced
2:00remaining
Diagnosing a failed GitHub Actions workflow due to missing permissions
A workflow fails with an error saying it cannot access the repository contents. What is the most likely cause?
AThe workflow is triggered on the wrong event.
BThe workflow file is missing the 'permissions' key with 'contents: read'.
CThe runner machine is offline.
DThe YAML syntax is invalid.
Attempts:
2 left
💡 Hint
GitHub Actions requires explicit permissions to access repository contents.
🔀 Workflow
expert
2:30remaining
Order of steps execution in a GitHub Actions job
Given a job with these steps, what is the order in which they execute?
A1,3,2,4
B2,1,3,4
C1,2,3,4
D4,3,2,1
Attempts:
2 left
💡 Hint
Steps run in the order they are listed in the YAML file.