Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’re pinning the action by its full commit SHA, which reduces readability and makes upgrades harder. It’s usually better to target the major version tag (e.g. @v8) or a full semver range to get non-breaking updates automatically. For example:

steps:
  - uses: actions/github-script@v8      # pulls latest v8.x.x
    with:
      script: |
        github.rest.git.deleteRef({
          owner: context.repo.owner,
          repo: context.repo.repo,
          ref: 'refs/heads/old-branch'
        })

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline comment for the version (# v8.0.0) is now out of sync with your SHA pin. Either update or remove it entirely to avoid confusion. If you switch to @v8 you can drop the comment, since it’s implied by the tag’s semantics.

with:
script: |
github.rest.git.deleteRef({
Comment on lines 21 to 22
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s safer to wrap the delete in a try/catch so that a missing ref (404) won’t fail the entire workflow. Here’s an example:

with:
  script: |
    try {
      await github.rest.git.deleteRef({
        owner: context.repo.owner,
        repo: context.repo.repo,
        ref: 'refs/heads/old-branch'
      })
      console.log('Ref deleted successfully')
    } catch (error) {
      if (error.status === 404) {
        console.log('Branch not found, skipping deletion')
      } else {
        throw error
      }
    }

Expand Down