Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3537526
D4703.id15177.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4703.id15177.diff
View Options
diff --git a/scripts/generate-phab-tag-removal-script.js b/scripts/generate-phab-tag-removal-script.js
--- a/scripts/generate-phab-tag-removal-script.js
+++ b/scripts/generate-phab-tag-removal-script.js
@@ -1,5 +1,6 @@
// @flow
+const { execSync } = require('child_process');
const fs = require('fs');
const { request } = require('gaxios');
@@ -31,13 +32,18 @@
return revisionsToBeRemoved;
};
-const getGitTagsToBeRemoved = revisionsToBeRemoved => {
+const getRemoteGitTags = () => {
+ const remoteGitTags = execSync('git tag');
+ return new Set(remoteGitTags.toString().split('\n'));
+};
+
+const getGitTagsToBeRemoved = (remoteGitTags, revisionsToBeRemoved) => {
const gitTagsToBeRemoved = [];
for (const revisionID of revisionsToBeRemoved) {
gitTagsToBeRemoved.push(`phabricator/base/${revisionID}`);
gitTagsToBeRemoved.push(`phabricator/diff/${revisionID}`);
}
- return gitTagsToBeRemoved;
+ return gitTagsToBeRemoved.filter(tag => remoteGitTags.has(tag));
};
const getGitCommandsToBeRun = gitTagsToBeRemoved => {
@@ -50,8 +56,12 @@
async function main() {
const differentialData = await getDifferentialDataFromPhabricator();
+ const remoteGitTags = getRemoteGitTags();
const revisionsToBeRemoved = getRevisionsToBeRemoved(differentialData);
- const gitTagsToBeRemoved = getGitTagsToBeRemoved(revisionsToBeRemoved);
+ const gitTagsToBeRemoved = getGitTagsToBeRemoved(
+ remoteGitTags,
+ revisionsToBeRemoved,
+ );
const gitCommandsToBeRun = getGitCommandsToBeRun(gitTagsToBeRemoved);
writeGitCommandsScriptToDisk(gitCommandsToBeRun);
process.exit(0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 9:50 PM (11 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2705337
Default Alt Text
D4703.id15177.diff (1 KB)
Attached To
Mode
D4703: [CI] Add `getRemoteGitTags()` to Harbormaster tag removal script
Attached
Detach File
Event Timeline
Log In to Comment