How can I run a scheduled pipeline on a changing branch?

Update Scheduled Pipelines for a Changing Branch

Scheduled Pipelines can be created and updated to run on a specific branch via the CircleCI API: https://circleci.com/docs/api/v2/index.html#operation/updateSchedule

curl --location --request PATCH "https://circleci.com/api/v2/schedule/{schedule-id}" \
--header "circle-token: <PERSONAL_API_KEY>" \
--header "Content-Type: application/json" \
--data-raw '{
"name": "my schedule name",
"description": "some description",
"attribution-actor": "system",
"parameters": {
"branch": "<UPDATED_BRANCH>"
<additional pipeline parameters can be added here>
},
"timetable": {
"per-hour": 3,
"hours-of-day": [1,15],
"days-of-week": ["MON", "WED"]
}
}'

 

Using another scheduled pipeline, you can query the project via API (on GitHub, you can use the list branches API) to get the latest/desired branch to run the scheduled pipeline on. Once the scheduled trigger is run, it will then be updated to the latest version for the next time it runs. The format should look like the following:

  1. Create a secondary scheduled pipeline to manage the changing pipeline
  2. Using the VCS API and the CircleCI API, update the changing scheduled pipeline as frequently as desired
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.