Skip to content

BUILD-9760 fix USER_MAVEN_ARGS #1001

BUILD-9760 fix USER_MAVEN_ARGS

BUILD-9760 fix USER_MAVEN_ARGS #1001

name: Test PR Cleanup Action
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
# Create a cache entry and an artifact when a PR is opened or updated
test-resources:
runs-on: github-ubuntu-latest-s
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
# Create test file and directory for cache
- name: Create test file for cache
run: |
mkdir -p test-cache
echo "Test content for cache" > test-cache/test.txt
- name: Save test cache
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ./test-cache
key: test-cache-${{ github.event.pull_request.number }}
- name: Create and upload test artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-artifact-${{ github.event.pull_request.number }}
path: test-cache/test.txt
retention-days: 1
test-cleanup:
runs-on: github-ubuntu-latest-s
needs: test-resources
permissions:
actions: write # Required for cache/artifact operations
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Run PR cleanup
uses: ./pr_cleanup
- name: Verify cache cleanup
env:
GH_TOKEN: ${{ github.token }}
run: |
# Try to restore the cache, should fail or be empty
mkdir -p test-cache
PR_NUMBER=${{ github.event.pull_request.number }}
CACHE_REF="refs/pull/$PR_NUMBER/merge"
if gh cache list --repo "$GITHUB_REPOSITORY" --ref "$CACHE_REF" | grep -q "test-cache-$PR_NUMBER"; then
echo "❌ Cache was not cleaned up"
exit 1
else
echo "✅ Cache was successfully cleaned up"
fi
- name: Verify artifact cleanup
env:
GH_TOKEN: ${{ github.token }}
run: |
# Check if artifact exists, should not find it
PR_NUMBER=${{ github.event.pull_request.number }}
ARTIFACT_NAME="test-artifact-$PR_NUMBER"
if gh api -X GET "/repos/$GITHUB_REPOSITORY/actions/artifacts" | grep -q "$ARTIFACT_NAME"; then
echo "❌ Artifact was not cleaned up"
exit 1
else
echo "✅ Artifact was successfully cleaned up"
fi