Skip to content

Commit

Permalink
chore(repo): plop stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian committed Jul 17, 2024
1 parent 10b4784 commit 438afb8
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 28 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ dist/
lib/
node_modules/
scripts/
templates/
5 changes: 3 additions & 2 deletions templates/docs.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Each of the following helpers are defined in a file of the same name in `src/helpers`: ### [{{helper}}](.github/workflows/{{helper}}.yml) *
{{description}}
Each of the following helpers are defined in a file of the same name in `src/helpers`:
### [{{ helper }}](.github/workflows/{{ helper }}.yml)
* {{ description }}
36 changes: 25 additions & 11 deletions templates/helper.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
/* Copyright 2021 Expedia, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the
License. */ import { HelperInputs } from '../types/generated'; import { context } from '@actions/github'; import { octokit } from
'../octokit'; export class
{{properCase helper}}
extends HelperInputs { requiredInput = ''; optionalInput?: string; } export const
{{camelCase helper}}
= async ({ requiredInput, optionalInput }:
{{properCase helper}}) => { };
/*
Copyright 2021 Expedia, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { HelperInputs } from '../types/generated';
import { context } from '@actions/github';
import { octokit } from '../octokit';

export class {{ properCase helper }} extends HelperInputs {
requiredInput = '';
optionalInput?: string;
}

export const {{ camelCase helper }} = async ({ requiredInput, optionalInput }: {{ properCase helper }}) => {

};
47 changes: 37 additions & 10 deletions templates/test.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
/* Copyright 2021 Expedia, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the
License. */ import { Mocktokit } from '../types'; import { context } from '@actions/github'; import {
{{camelCase helper}}
} from '../../src/helpers/{{dashCase helper}}'; import { octokit } from '../../src/octokit'; jest.mock('@actions/core');
jest.mock('@actions/github', () => ({ context: { repo: { repo: 'repo', owner: 'owner' }, issue: { number: 123 } }, getOctokit: jest.fn(() =>
({ rest: { } })) })); describe('{{camelCase helper}}', () => { beforeEach(() => {
{{camelCase helper}}({ requiredInput: '', optionalInput: '' }); }); it('should pass', () => { expect(false).toBe(true); }); });
/*
Copyright 2021 Expedia, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { Mocktokit } from '../types';
import { context } from '@actions/github';
import { {{ camelCase helper }} } from '../../src/helpers/{{ dashCase helper }}';
import { octokit } from '../../src/octokit';

jest.mock('@actions/core');
jest.mock('@actions/github', () => ({
context: { repo: { repo: 'repo', owner: 'owner' }, issue: { number: 123 } },
getOctokit: jest.fn(() => ({
rest: {

}
}))
}));

describe('{{ camelCase helper }}', () => {
beforeEach(() => {
{{ camelCase helper }}({ requiredInput: '', optionalInput: '' });
});

it('should pass', () => {
expect(false).toBe(true);
});
});
22 changes: 17 additions & 5 deletions templates/workflow.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
name:
{{spaceSeparatedCase (titleCase helper)}}
name: {{ spaceSeparatedCase ( titleCase helper ) }}

on: pull_request: branches: [ main ] paths: - 'src/helpers/{{dashCase helper}}.ts' jobs: test: runs-on: ubuntu-latest steps: - name:
Checkout uses: actions/checkout@v4 - uses: ./ with: helper:
{{dashCase helper}}
on:
pull_request:
branches: [ main ]
paths:
- 'src/helpers/{{ dashCase helper }}.ts'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ./
with:
helper: {{ dashCase helper }}

0 comments on commit 438afb8

Please sign in to comment.