Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMNO Action MVP #3

Merged
merged 39 commits into from
Jan 8, 2025
Merged

DMNO Action MVP #3

merged 39 commits into from
Jan 8, 2025

Conversation

philmillman
Copy link
Contributor

No description provided.

@philmillman philmillman changed the title very very WIP, initial commit DMNO Action MVP Jan 2, 2025
const serviceName = inputs.serviceName || 'root'
args.push(`--service ${serviceName}`)
// service selection
if (inputs.serviceName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill fix the defaulting behaviour in dmno directly

@@ -82,7 +83,7 @@ export async function run(): Promise<void> {

// Execute dmno and capture output directly
const { stderr } = await getExecOutput(
`${packageManager} exec dmno resolve ${createArgString(inputs).join(' ')}`,
`${packageManager} exec -- dmno resolve ${createArgString(inputs).join(' ')}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

safer for npm/yarn

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also try calling ./node_modules/.bin/dmno directly.

We can explore this later. It might be good for a non js repo, and have it just work without needing a package.json file

Copy link
Contributor Author

@philmillman philmillman Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue is now we rely on it already being a js repo, definitely something to explore for the future. we could detect if it's missing and install it

uses: ./
with:
milliseconds: 2000
# - name: Test Local Action
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be able to make this work now - and can use the example config to actually do a basic smoke test

CONTRIBUTING.md Outdated
@@ -0,0 +1,161 @@
# Create a GitHub Action Using TypeScript
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update or delete?

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
name: Example Multi-job DMNO GH Action
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe some clarification about loading the current config into env vars, versus needing to do something with multiple steps?

Copy link
Contributor Author

@philmillman philmillman Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be better suited to a guide somewhere? I think the main confusion is multi-step (which basically everyone needs to do) vs multi-job which seems maybe less necessary?

steps:
# REST OF WORKFLOW
- uses: dmno-dev/dmno-gh-action@v1
id: dmnoStep
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there something weird with these spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be a result of the linting?


expect(runMock).toHaveBeenCalled()
it('calls run when imported', async () => {
await import('../src/index.js')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 tests like this are so silly... fine to leave it since it was part of the template though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i didn't write that lol

package.json Outdated
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"all": "npm run format:write && npm run lint && npm run test && npm run package",
"make-badge": "npx make-coverage-badge --output-path ./badges/coverage.svg"
},
"license": "MIT",
"jest": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can kill the jest config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah will do

package.json Outdated
"typescript": "^5.7.2"
}
"typescript": "^5.7.2",
"vitest": "^1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for the old version of vitest?

Copy link
Contributor Author

@philmillman philmillman Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea, I think I just did an npm install, can update

@@ -1,7 +1,7 @@
/**
* The entrypoint for the action.
*/
import { run } from './main'
import { run } from './main.js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to not have to use .js extensions in ts files. IIRC, the fix involves changing the tsconfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think so, I was balancing not breaking the existing ts stuff elsewhere, but I don't like the .js extension either

README.md Outdated
- `emit-env-vars`: Whether to emit environment variables, defaults to true
- `output-vars`: Whether to also provide the variables in the output, defaults
to false
- `skip-regex`: The regex to skip config for, defaults to empty string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont have to do it right now, but we may want to think through these options - and its related options on dmno itself. Like does skipping it mean we dont resolve it at all? or just not export it? I could imagine emit-env-vars taking an array of strings, which could be treated as either strings or regexes, etc...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipping currently means we just skip outputting it either in the env vars or the output vars, we can revisit when dmno itself lets us skip in a similar way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep! just making that mental note to come back to this when we do :)

@philmillman philmillman merged commit c626e2d into main Jan 8, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants