Skip to content

Commit

Permalink
Verify milestone and tag name match
Browse files Browse the repository at this point in the history
  • Loading branch information
pierlon committed Sep 2, 2021
1 parent 5b6e433 commit 752872d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/actions/draft-release/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ async function main() {
}

// Get tag name from plugin main PHP file.
let tagName = '';
const pluginFile = fs.readFileSync(path.resolve(process.cwd(), 'amp.php')).toString();
const matches = /\*\s+Version:\s+(\d+(\.\d+)+-\w+)/.exec(pluginFile);
if (matches && matches[1]) {
[, tagName] = matches;
const tagName = matches?.[1];

if (! tagName) {
throw new Error( 'Unable to parse Version from plugin bootstrap PHP file.' );
}

if (! tagName.startsWith(milestone)) {
throw new Error( "Milestone mismatch with PHP plugin bootstrap version." );
}

// Get target branch.
Expand Down

0 comments on commit 752872d

Please sign in to comment.