Skip to content

Commit e139126

Browse files
committed
docs: update documentation in update-test_update_actions.sh
1 parent ba45225 commit e139126

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

scripts/update-test_update_actions.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
#!/bin/sh
22
# Rationale:
3-
# Ci-starter has the subcommand update-actions to update an end-user's project's workflow files to that they
4-
# use the latest versions of the GitHub actions. This updates the actions in all of the end-user's project's
5-
# workflow files, regardless whether these workflow files have been created with ci-starter or manually.
6-
#
3+
# Ci-starter's subcommand update-actions updates an end-user's project's workflow files so that they
4+
# use the latest versions of the GitHub actions. This updates the action versions in all of the end-user's
5+
# project's workflow files, regardless whether these workflow files have been created with ci-starter or
6+
# manually.
7+
#
78
# Ci-starter project has an end-to-end test where we test if this update-actions subcommand works properly.
89
# In that test we check if the handful of actions ci-starter uses in its workflow templates are updated
9-
# correctly and match their respective expeced commit SHA and version. The expected current commit SHA
10+
# correctly and match their respective expected commit SHA and version. The expected current commit SHA
1011
# and version of each GitHub action needs to be hard-coded in the end-to-end test.
1112
# However, as time goes on, the expected commit SHAs and versions of the updated actions from ci-starter's
1213
# templates change because these actions, too, are getting new releases from time to time.
1314
#
1415
# The maintainer of the ci-starter project needs a way to update the end-to-end test's code
15-
# so that the expected versions match the actual current version of the actions. Doing this manually is
16-
# cumbersome. This script was written to update the code of the end-to-end test of the
17-
# update-actions subcommand programatically.
16+
# so that the expected versions match the actual current versions of the actions. Doing this manually is
17+
# cumbersome. This script was written to update the code of the end-to-end test of the update-actions
18+
# subcommand programatically.
1819
#
1920
# Usage:
2021
# - make sure you are in the ci-starter's project directory
2122
# - uv executable is in $PATH
2223
# - ci-starter project is installed with the lint dev-dependency group
23-
# - for frequent use provide a GitHub personal access token to avoid getting rate-limited
24+
# - provide a GitHub personal access token to avoid getting rate-limited:
2425
# CI_STARTER_GH_API_TOKEN=<your-access-token-for-github> ./scripts/update-test_update_actions.sh
2526

2627
WORKFLOWS=./.github/workflows
2728
TEST_FILE=./tests/e2e/test_update_actions.py
2829

29-
actions_from_all_workflows() {
30+
find_lines_where_action_is_pinned_to_sha_and_commented_with_version() {
3031
find "$WORKFLOWS" -type f -name "*.yml" \
3132
| xargs sed -nE 's$uses: ([^[:space:]]+)/([^[:space:]]+)@([0-9a-f]{40}) # v([^[:space:]]+)$\1 \2 \3 \4$p' \
3233
| sort | uniq
3334
}
3435

3536
get_actions_from_all_workflows_with_their_latest_commits_and_versions() {
36-
actions_from_all_workflows | while read owner repo old_commit old_version; do
37+
find_lines_where_action_is_pinned_to_sha_and_commented_with_version | while read owner repo old_commit old_version; do
3738
url="https://api.github.com/repos/$owner/$repo/tags"
3839

3940
if [ -n "$CI_STARTER_GH_API_TOKEN" ]; then

0 commit comments

Comments
 (0)