Skip to content

Commit fb8cf0d

Browse files
Merge pull request #118 from DSACMS/DSACMS/nat/archive-pr-body
Archive Mode: Add new PR title and body for archive mode
2 parents a4a8d3f + 1359dee commit fb8cf0d

2 files changed

Lines changed: 33 additions & 12 deletions

File tree

src/helper.ts

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const execAsync = promisify(exec);
1414

1515
const TOKEN = core.getInput("GITHUB_TOKEN", { required: true });
1616
const ADMIN_TOKEN = core.getInput("ADMIN_TOKEN", { required: false });
17+
const isArchived = core.getInput("ARCHIVE", { required: false }) === "true";
1718

1819
const MyOctoKit = ActionKit.plugin(createPullRequest);
1920
const octokit = new MyOctoKit({
@@ -28,14 +29,14 @@ const octokit = new MyOctoKit({
2829

2930
const adminOctokit = ADMIN_TOKEN
3031
? new MyOctoKit({
31-
auth: ADMIN_TOKEN,
32-
log: {
33-
debug: core.debug,
34-
info: core.info,
35-
warn: core.warning,
36-
error: core.error,
37-
},
38-
})
32+
auth: ADMIN_TOKEN,
33+
log: {
34+
debug: core.debug,
35+
info: core.info,
36+
warn: core.warning,
37+
error: core.error,
38+
},
39+
})
3940
: null;
4041

4142
const owner = process.env.GITHUB_REPOSITORY_OWNER ?? "";
@@ -195,11 +196,11 @@ export async function sendPR(
195196
const PR = await octokit.createPullRequest({
196197
owner,
197198
repo,
198-
title: "Update code.json",
199-
body: bodyOfPR(),
199+
title: isArchived ? "Update code.json for archival" : "Update code.json",
200+
body: isArchived ? bodyOfArchivalPR() : bodyOfPR(),
200201
base: baseBranchName,
201202
head: headBranchName,
202-
labels: ["codejson-initialized"],
203+
labels: isArchived ? ["archived"] : ["codejson-initialized"],
203204
changes: [
204205
{
205206
files: {
@@ -321,3 +322,23 @@ function bodyOfPR(): string {
321322
If you would like additional information about the code.json metadata requirements, please visit the repository [here](https://github.com/DSACMS/gov-codejson).
322323
`;
323324
}
325+
326+
function bodyOfArchivalPR(): string {
327+
return `
328+
## Archiving the Repository
329+
330+
Hello, and thank you for your contributions to the Federal Open Source Community. 🙏
331+
332+
As part of preparing the repository for archival, this pull request marks the repository for archival and ensures code.json repository metadata is up-to-date.
333+
334+
If you have questions, please file an issue [here](https://github.com/DSACMS/automated-codejson-generator/issues) or join our #cms-ospo slack channel [here](https://cmsgov.enterprise.slack.com/archives/C07HM92S9QQ).
335+
336+
## Next Steps
337+
### Verify project metadata in code.json
338+
- Review all fields to ensure metadata is correct and accurate
339+
- We have automatically updated some fields but some require manual input. Please update fields by directly editing code.json in Files Changed tab on your pull-request
340+
- We also have a [form](https://dsacms.github.io/codejson-generator/) where you can create your code.json via a website, and then download directly to your local machine, and then you can copy and paste into here.
341+
342+
If you would like additional information about the code.json metadata requirements, please visit the repository [here](https://github.com/DSACMS/gov-codejson).
343+
`;
344+
}

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async function getMetaData(
127127

128128
if (isArchived) {
129129
status = "Archival";
130-
tags?.push("Archived");
130+
tags?.push("archived");
131131
}
132132

133133
return {

0 commit comments

Comments
 (0)