Skip to content

Commit 0f0d5f0

Browse files
updated README and set workflow outputs
Signed-off-by: Sachin Panayil <sachinpanayil01@gmail.com>
1 parent 6fb44e7 commit 0f0d5f0

6 files changed

Lines changed: 54 additions & 10 deletions

File tree

.github/workflows/updateCodeJSON.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ jobs:
1717
fetch-depth: 0
1818

1919
- name: Update code.json
20-
uses: DSACMS/automated-codejson-generator@main
20+
id: generator
21+
uses: DSACMS/automated-codejson-generator@v1.0.0
2122
with:
2223
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23-
BRANCH: "main"
24+
BRANCH: "main"
25+
26+
- name: Print outputs
27+
run: |
28+
echo "Your code.json has been updated: ${{steps.generator.outputs.updated}}"
29+
echo "Pull Request Link: ${{steps.generator.outputs.pr_url}}"

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ GITHUB_TOKEN:
1515
default: ${{ github.token }}
1616
```
1717
18-
## Usage
18+
## Outputs
19+
20+
```yaml
21+
updated:
22+
description: "Boolean indicating whether code.json was updated"
23+
pr_url:
24+
description: "URL of the created pull request if changes were made"
25+
```
26+
27+
## Workflow Examples
1928
2029
### Create a PR to add compliant code.json
2130
2231
```yaml
2332
name: Update Code.json
2433
on:
34+
schedule: 0 0 1 * * # Example of running first day of every month
2535
workflow_dispatch:
2636

2737
permissions:
@@ -45,6 +55,29 @@ jobs:
4555
BRANCH: "main"
4656
```
4757
58+
## Generation Context
59+
The automated code.json generator calculates specific fields by analyzing your repository and using GitHub's API. Here's what gets generated and what your repository needs for successful generation.
60+
61+
**name**: This field pulls directly from your repository's name as configured in GitHub. No configuration needed.
62+
63+
**description**: The generator extracts this from your repository's description field in GitHub settings. *Make sure you've added a description to your repository through GitHub's interface for this field to populate properly.*
64+
65+
**repositoryURL**: This automatically uses your repository's public GitHub URL. No configuration needed.
66+
67+
**repositoryVisibility**: The generator determines whether your repository is private or public. No configuration needed.
68+
69+
**laborHours**: The generator runs SCC against your workspace to analyze your codebase and estimate development time. No configuration needed.
70+
71+
**languages**: This field populates the programming languages in your repository. No configuration needed.
72+
73+
**dateCreated**: The generator pulls your repository's creation date. No configuration needed.
74+
75+
**dateLastModified**: This uses your repository's last update timestamp, reflecting the most recent changes. No configuration needed.
76+
77+
**dateMetaDataLastUpdated**: The generator sets this to the current timestamp each time it runs, providing a record of when the metadata was last refreshed. No configuration needed.
78+
79+
**feedbackMechanisms**: A list of containing your repository's issues URL in the format of {repositoryURL}/issues. If you already have a code.json file with existing feedback mechanisms, the generator preserves those values. No configuration needed.
80+
4881
## Project Vision
4982
5083
To streamline federal agencies' compliance with open source requirements by automating the maintenance of code.json files, reducing manual effort and improving accuracy of repository metadata.
@@ -100,7 +133,7 @@ To develop locally:
100133
1. Clone the repository
101134
2. Install dependencies with `npm install`
102135
3. Install Go and SCC tool: `go install github.com/boyter/scc/v3@latest`
103-
4. Build the project with `npm run package`
136+
4. Build the project with `npm run bundle`
104137
5. Run tests with `npm test`
105138

106139
## Coding Style and Linters

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ inputs:
77
description: "GitHub token used for API access"
88
required: true
99
default: ${{ github.token }}
10-
10+
1111
BRANCH:
1212
description: "Name of the branch the PR is sent to"
1313
required: false
@@ -24,5 +24,5 @@ runs:
2424
image: Dockerfile
2525

2626
branding:
27-
icon: 'file-text'
28-
color: 'blue'
27+
icon: "file-text"
28+
color: "blue"

dist/index.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/helper.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ export async function sendPR(updatedCodeJSON: CodeJSON) {
144144

145145
if (PR) {
146146
core.info(`Successfully created PR: ${PR.data.html_url}`);
147+
148+
core.setOutput("updated", PR);
149+
core.setOutput("pr_url", PR.data.html_url);
147150
} else {
148151
core.error(`Failed to create PR because of PR object`);
149152
}

0 commit comments

Comments
 (0)