- Newest
- Most votes
- Most comments
It seems there might be a misunderstanding in how you've set up your CodeBuild project for GitHub Actions integration. When using CodeBuild as a self-hosted GitHub Actions runner, you don't need to manually create a webhook or configure it to trigger on pull requests. Instead, the process should be as follows:
- Create a CodeBuild project specifically for hosting GitHub Actions runners.
- In the project settings, under "Primary source webhook events", select "Rebuild every time a code change is pushed to this repository".
- For the "Event type", choose "WORKFLOW_JOB_QUEUED". This is crucial as it ensures CodeBuild only processes GitHub Actions workflow jobs.
The "YAML file does not exist" error suggests that CodeBuild is trying to run a build directly, rather than acting as a GitHub Actions runner. This behavior indicates that the webhook might be incorrectly configured.
Regarding your questions:
-
You don't need to explicitly register the CodeBuild runner with your GitHub repository. The integration between CodeBuild and GitHub Actions is handled automatically when you set up the project correctly.
-
The runner registration is managed by CodeBuild when it's properly configured as a GitHub Actions runner. You don't need to handle this manually.
To resolve the issue:
-
Review your CodeBuild project settings and ensure you've selected "WORKFLOW_JOB_QUEUED" as the event type.
-
Make sure your GitHub Actions workflow YAML file includes the correct runner label. It should look something like this:
runs-on: - codebuild-myProject-${{ github.run_id }}-${{ github.run_attempt }}Replace "myProject" with your actual CodeBuild project name.
-
If you've manually set up webhooks in your GitHub repository settings, remove them and let CodeBuild handle the webhook creation.
-
Ensure your GitHub Actions workflow file is properly formatted and located in the correct directory (.github/workflows) in your repository.
By following these steps, CodeBuild should correctly function as a self-hosted GitHub Actions runner without requiring a buildspec file or manual runner registration.
Sources
Self-hosted GitHub Actions runners in AWS CodeBuild - AWS CodeBuild
AWS CodeBuild Managed Self-Hosted GitHub Action Runners | AWS DevOps & Developer Productivity Blog
Label overrides supported with the CodeBuild-hosted GitHub Actions runner - AWS CodeBuild
I was able to run the workflow by selecting the "workflow jobs" option. I checked "Pull requests," which triggered two builds. One build ran successfully with the workflow job, but the other one encountered an error stating, "YAML file does not exist."
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 2 months ago
