Skip to content

Commit a2cf118

Browse files
Update README.md
1 parent f036a32 commit a2cf118

File tree

3 files changed

+38
-92
lines changed

3 files changed

+38
-92
lines changed

README.md

Lines changed: 36 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,48 @@
1-
<p align="center">
2-
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
3-
</p>
1+
# Crosspost Markdown
42

5-
# Create a JavaScript Action using TypeScript
3+
If a tree falls in the woods, does it make a sound?
64

7-
Use this template to bootstrap the creation of a TypeScript action.:rocket:
5+
Publish your repo's markdown to multiple distributors with a simple `git push`, so that when your tree falls, it makes a sound.
86

9-
This template includes compilation support, tests, a validation workflow, publishing, and versioning guidance.
7+
## Current Integration
8+
* [DEV](https://dev.to)
109

11-
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
10+
Create an Issue if you have another distributor that you'd like to add to this git action.
1211

13-
## Create an action from this template
12+
## Arguments
1413

15-
Click the `Use this Template` and provide the new repo details for your action
14+
| Input | Description | Usage |
15+
| :---: | :---: | :---: |
16+
| `github-token` | GitHub Auth Token | *Required* |
17+
| `content-dir` | Path from the root to your markdown files. Defaults to `./content/articles/` | Optional |
18+
| `dev-to-token` | API token for dev.to. (https://dev.to/settings/account) | *Required* |
1619

17-
## Code in Main
18-
19-
Install the dependencies
20-
```bash
21-
$ npm install
22-
```
23-
24-
Build the typescript and package it for distribution
25-
```bash
26-
$ npm run build && npm run package
27-
```
28-
29-
Run the tests :heavy_check_mark:
30-
```bash
31-
$ npm test
32-
33-
PASS ./index.test.js
34-
✓ throws invalid number (3ms)
35-
wait 500 ms (504ms)
36-
test runs (95ms)
37-
38-
...
39-
```
40-
41-
## Change action.yml
42-
43-
The action.yml contains defines the inputs and output for your action.
44-
45-
Update the action.yml with your name, description, inputs and outputs for your action.
46-
47-
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
48-
49-
## Change the Code
50-
51-
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
52-
53-
```javascript
54-
import * as core from '@actions/core';
55-
...
56-
57-
async function run() {
58-
try {
59-
...
60-
}
61-
catch (error) {
62-
core.setFailed(error.message);
63-
}
64-
}
65-
66-
run()
67-
```
68-
69-
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
70-
71-
## Publish to a distribution branch
72-
73-
Actions are run from GitHub repos so we will checkin the packed dist folder.
74-
75-
Then run [ncc](https://github.com/zeit/ncc) and push the results:
76-
```bash
77-
$ npm run package
78-
$ git add dist
79-
$ git commit -a -m "prod dependencies"
80-
$ git push origin releases/v1
81-
```
82-
83-
Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project.
84-
85-
Your action is now published! :rocket:
86-
87-
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
88-
89-
## Validate
90-
91-
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml))
20+
## Example usage
9221

9322
```yaml
94-
uses: ./
95-
with:
96-
milliseconds: 1000
23+
name: CrossPost
24+
25+
on:
26+
push:
27+
paths:
28+
- 'content/articles/*.md'
29+
30+
jobs:
31+
crosspost:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout Code
35+
uses: actions/checkout@v2
36+
37+
- uses: basicBrogrammer/[email protected]
38+
with:
39+
content-dir: 'content/articles/'
40+
dev-to-token: ${{ secrets.DEV_TO }}
41+
github-token: ${{ secrets.GITHUB_TOKEN }}
9742
```
9843
99-
See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket:
100-
101-
## Usage:
44+
## Contribute
10245
103-
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action
46+
This action is still under construction.
47+
Report any issues you have.
48+
Pull requests welcome. 🤙

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ branding:
66
color: purple
77
inputs:
88
github-token:
9-
description: 'Location to blog markdown files.'
9+
description: 'GitHub Auth Token.'
1010
required: true
1111
content-dir:
1212
description: 'Location to blog markdown files.'

src/publish/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ const publish = async (path: string): Promise<void> => {
2525
core.setFailed(err.message);
2626
}
2727
};
28+
2829
export default publish;

0 commit comments

Comments
 (0)