Skip to content
Draft
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/rocm-ci-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
types: [ labeled, synchronize, reopened ]

permissions:
actions: write
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why permission elevation is needed for this action?

contents: read

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/rocm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The same as before: why does it need permission elevation

actions: write
contents: read

env:
TEST_LEVEL: ${{ (github.event_name == 'push' && '3') || inputs.test_level || '1' }}

Expand Down
41 changes: 40 additions & 1 deletion .github/workflows/rocm-wheels-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ env:
DOCKER_IMAGE_NAME: te-rocm-manylinux-x86
MANYLINUX_PLATFORM: manylinux_2_28_x86_64

permissions:
actions: write
contents: read

# ─────────────────────────────────────────────────────────────────────────────
jobs:

Expand Down Expand Up @@ -212,6 +216,41 @@ jobs:
find "$LOG_DIR" -type f | sort
fi

- name: Delete previous wheel artifacts for this branch
if: success()
env:
GH_TOKEN: ${{ github.token }}
run: |
BRANCH="${{ github.head_ref || github.ref_name }}"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it tested in all trigger scenarios? I'm not confident that github.head_ref and github.ref_name do always contain what we need

echo "Cleaning up old te-rocm-wheels artifacts for branch: $BRANCH"

# Collect artifact IDs to delete
if ! IDS=$(gh api --paginate "repos/${{ github.repository }}/actions/artifacts?name=te-rocm-wheels" \
--jq ".artifacts[] | select(.expired == false and .workflow_run.head_branch == \"$BRANCH\") | .id"); then
echo "::warning::Failed to list artifacts (possible permissions issue). Skipping cleanup."
exit 0
fi

if [ -z "$IDS" ]; then
echo "No previous artifacts found for this branch."
else
echo "Deleting artifacts:"
FAILED=0
for id in $IDS; do
gh api "repos/${{ github.repository }}/actions/artifacts/$id" \
--jq '"\(.id)\t\(.size_in_bytes / 1024 / 1024 | round)MB\t\(.created_at)"' || true
if ! gh api -X DELETE "repos/${{ github.repository }}/actions/artifacts/$id"; then
echo "::warning::Failed to delete artifact $id (possible permissions issue)."
FAILED=$((FAILED + 1))
fi
done
if [ "$FAILED" -gt 0 ]; then
echo "::warning::Failed to delete $FAILED artifact(s). Ensure the workflow has 'actions: write' permission."
else
echo "Cleanup complete."
fi
fi

- name: Upload wheels as GitHub Actions artifacts
if: success()
uses: actions/upload-artifact@v4
Expand All @@ -220,7 +259,7 @@ jobs:
path: |
${{ runner.temp }}/wheelhouse/*.whl
${{ runner.temp }}/wheelhouse/*.tar.gz
retention-days: 1
retention-days: 7
if-no-files-found: error

- name: Upload build logs on failure
Expand Down
Loading