I have a reusable workflow that I have created in Github Actions, it uses AWS CodeBuild as a runner i.e.
jobs:
docker:
runs-on: codebuild-XXX-XXX-${{ github.run_id }}-${{ github.run_attempt }}
The workflow runs fine on CodeBuild when I invoke it using workflow dispatch, but when I call it from another repository it hangs with waiting for runner...
I have tried to add a webhook to the codebuild job for the calling repository, and added a GITHUB_TOKEN to the reusable workflow.
Not sure where to go next to debug / what could be causing this.
Thanks in advance
2
Answers
In this case, if you aren’t seeing any builds triggered within the project as a result of the webhook request, I’m guessing that the webhook request got rejected by CodeBuild. To debug, you can follow the steps at https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html:
https://github.com/<user-name>/<repository-name>/settings/hooks
in the GitHub consoleRecent Deliveries
tab and look for aworkflow_job.queued
eventFrom the description, it seems your setup looks like this:
Repo 1 (hosting the reusable workflow) -> webhook 1 -> CodeBuild project(project name: "XXX-XXX")
Repo 2 (hosting a workflow that calls the workflow in Repo 1) -> webhook 2 -> CodeBuild Project (project name: "YYY-YYY")
If that is the case, workflow job requests from Repo 2 will be sent to project
YYY-YYY
and get rejected, with an exception message"Cannot resolve label or label did not match webhook project name: codebuild-XXX-XXX"
.The key issue is the mismatched project name and I can think of two solutions.
project_name
as an input. There are some other ways to achieving this, see https://github.com/search?q=%22+codebuild-%24%7B%7B%22&type=code