Skip to content

chore(deps): update helm release memcached to v7 #94

chore(deps): update helm release memcached to v7

chore(deps): update helm release memcached to v7 #94

Workflow file for this run

name: Check for ephemeral PR images
on:
# push:
pull_request:
jobs:
check-files:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Check files matching glob patterns for pr-\d+ pattern
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const fs = require('fs');
const prPattern = /ghcr\.io\/rackerlabs\/understack.*pr-\d+/
// Define glob patterns for files to check for reference to PR images
const globPatterns = [
'**/*.yml',
'**/*.yaml',
'**/Dockerfile*',
'**/.env*',
];
// Exclude files from checks
const excludePatterns = [
'!**/.git/**',
'!**/docs/**',
'!**/ansible/**'
];
// Combine include and exclude patterns
const allPatterns = [...globPatterns, ...excludePatterns];
core.info('Inspecting files matching following glob patterns:');
globPatterns.forEach(pattern => core.info(` Include: ${pattern}`));
excludePatterns.forEach(pattern => core.info(` Exclude: ${pattern}`));
core.info('');
const globber = await glob.create(allPatterns.join('\n'));
const filesToCheck = await globber.glob();
core.info(`Found ${filesToCheck.length} files matching glob patterns:`);
filesToCheck.forEach(file => core.debug(` - ${file}`));
core.debug('');
let hasPatternMatch = false;
const matchedFiles = [];
for (const filePath of filesToCheck) {
try {
const fileContent = fs.readFileSync(filePath, 'utf8');
if (prPattern.test(fileContent)) {
hasPatternMatch = true;
matchedFiles.push(filePath);
core.error(`❌ Ephemeral container image reference found in: ${filePath}`);
} else {
core.debug(`✅ No pattern found in: ${filePath}`);
}
} catch (error) {
core.info(`Error reading file ${filePath}: ${error.message}`);
}
}
if (hasPatternMatch) {
core.setFailed(`Pattern 'pr-\\d+' found in ${matchedFiles.length} files: ${matchedFiles.join(', ')}`);
core.info(`Please switch to a different tag before merging as this container image will not be available after PR is merged`)
core.info(`Alternatively, if this is intended, edit .github/workflows/no-pr-images.yaml -> excludePatterns.`)
} else {
core.info(`✅ All ${filesToCheck.length} files checked - no pr-\\d+ pattern found`);
}