name: aqlprofile Deprecation Warning # projects/aqlprofile has been migrated into # projects/rocprofiler-sdk/source/lib/aqlprofile and is deprecated. Any PR that # still modifies projects/aqlprofile is flagged (labeled + commented) and the # check fails so the change can be redirected to the embedded copy instead. # # SECURITY: pull_request_target runs in the BASE-repo context, so the token can # label/comment even for PRs opened from forks. This workflow NEVER checks out # or executes PR head code; it only reads/writes PR metadata via the GitHub API. # Do NOT add build/test/install steps that run PR-provided code, and do NOT add # a checkout of the PR head. # Refs: # https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target on: pull_request_target: types: [opened, synchronize, reopened] paths: - 'projects/aqlprofile/**' # Least privilege: pull-requests:write covers commenting on and labeling the PR # (PR comments/labels use the issues REST endpoints but are authorized by the # pull-requests scope; issues:write is only needed for standalone issues). permissions: contents: read pull-requests: write concurrency: group: aqlprofile-deprecation-${{ github.event.pull_request.number }} cancel-in-progress: true jobs: warn-and-block: name: aqlprofile-deprecation # Only run on the canonical repo, not on forks/mirrors. if: github.repository == 'ROCm/rocm-systems' runs-on: ubuntu-24.04 steps: - name: Label and comment deprecation warning uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: | const label = 'wontfix'; const marker = ''; const { owner, repo } = context.repo; const issue_number = context.payload.pull_request.number; // Apply the deprecation label (an existing repo label, so no auto-create). try { await github.rest.issues.addLabels({ owner, repo, issue_number, labels: [label], }); } catch (error) { core.warning(`Could not add label "${label}": ${error.message}`); } const body = [ marker, '## :warning: `projects/aqlprofile` is deprecated :warning:', '', 'This PR modifies files under `projects/aqlprofile/`, which has been migrated into the `projects/rocprofiler-sdk` source tree and is no longer the source of truth.', '', '**Please redirect your changes to the embedded copy:**', '', '```', 'projects/rocprofiler-sdk/source/lib/aqlprofile/', '```', '', 'The standalone `projects/aqlprofile` copy is being retired, and all ongoing development now happens in the embedded copy. Unless you have an explicit exception, please close this PR and reopen your changes against the embedded copy above.', '', 'cc @ROCm/rocm-devtools-team', ].join('\n'); // Idempotent: update our existing warning comment if one is present. const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number, per_page: 100, }); const existing = comments.find((c) => c.body && c.body.includes(marker)); if (existing) { await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body, }); } else { await github.rest.issues.createComment({ owner, repo, issue_number, body, }); } - name: Fail check to block merge run: | echo "::error::projects/aqlprofile is deprecated; move changes to projects/rocprofiler-sdk/source/lib/aqlprofile/" exit 1