Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit 12c8281

Browse files
committed
init
1 parent 707bdae commit 12c8281

40 files changed

+2313
-6014
lines changed

.eslintrc.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
1-
name: "units-test"
2-
on:
3-
pull_request:
4-
push:
5-
branches:
6-
- master
7-
- 'releases/*'
1+
name: Test Action
82

9-
jobs:
10-
# unit tests
11-
units:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v1
15-
- run: npm ci
16-
- run: npm test
3+
on: push
174

18-
# test action works running from the graph
5+
jobs:
196
test:
207
runs-on: ubuntu-latest
218
steps:
22-
- uses: actions/checkout@v1
23-
- uses: ./
24-
with:
25-
milliseconds: 1000
9+
- name: Checkout repo
10+
uses: actions/checkout@v2
11+
- name: Try push
12+
uses: ./
13+
with:
14+
tries: 5

.gitignore

Lines changed: 0 additions & 65 deletions
This file was deleted.

LICENSE

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3-
Copyright (c) 2019 GitHub Actions
3+
Copyright (c) 2020 Dawid Dziurla
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 11 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,17 @@
1+
# Git try push Github Action
12

2-
<p align="center">
3-
<a href="https://github.com/actions/javascript-action/actions"><img alt="javscript-action status" src="https://github.com/actions/javascript-action/workflows/units-test/badge.svg"></a>
4-
</p>
5-
6-
# Create a JavaScript Action
7-
8-
Use this template to bootstrap the creation of a JavaScript action.:rocket:
9-
10-
This template includes tests, linting, a validation workflow, publishing, and versioning guidance.
11-
12-
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
13-
14-
## Create an action from this template
15-
16-
Click the `Use this Template` and provide the new repo details for your action
17-
18-
## Code in Master
19-
20-
Install the dependencies
21-
```bash
22-
$ npm install
23-
```
24-
25-
Run the tests :heavy_check_mark:
26-
```bash
27-
$ npm test
28-
29-
PASS ./index.test.js
30-
✓ throws invalid number (3ms)
31-
wait 500 ms (504ms)
32-
test runs (95ms)
33-
34-
...
35-
```
36-
37-
## Change action.yml
38-
39-
The action.yml contains defines the inputs and output for your action.
40-
41-
Update the action.yml with your name, description, inputs and outputs for your action.
42-
43-
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
44-
45-
## Change the Code
46-
47-
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
48-
49-
```javascript
50-
const core = require('@actions/core');
51-
...
52-
53-
async function run() {
54-
try {
55-
...
56-
}
57-
catch (error) {
58-
core.setFailed(error.message);
59-
}
60-
}
61-
62-
run()
63-
```
64-
65-
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
66-
67-
## Package for distribution
68-
69-
GitHub Actions will run the entry point from the action.yml. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in node_modules.
70-
71-
Actions are run from GitHub repos. Packaging the action will create a packaged action in the dist folder.
72-
73-
Run package
74-
75-
```bash
76-
npm run package
77-
```
78-
79-
Since the packaged index.js is run from the dist folder.
80-
81-
```bash
82-
git add dist
83-
```
84-
85-
## Create a release branch
86-
87-
Users shouldn't consume the action from master since that would be latest code and actions can break compatibility between major versions.
88-
89-
Checkin to the v1 release branch
90-
91-
```bash
92-
$ git checkout -b v1
93-
$ git commit -a -m "v1 release"
94-
```
95-
96-
```bash
97-
$ git push origin v1
98-
```
99-
100-
Your action is now published! :rocket:
101-
102-
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
3+
An action that tries to make a `git push`. If it does not succeed, then wait some time and try again. The number of maximum tries is controllable via `tries` input.
1034

1045
## Usage
1056

106-
You can now consume the action by referencing the v1 branch
107-
1087
```yaml
109-
uses: actions/javascript-action@v1
110-
with:
111-
milliseconds: 1000
8+
- name: Try pushing
9+
uses: dawidd6/action-git-try-push@master
10+
with:
11+
# Optional, used for pushing
12+
token: ${{github.token}}
13+
# Optional, defaults to current directory
14+
directory: path/to/repo
15+
# Optional, defaults to 10
16+
tries: 20
11217
```
113-
114-
See the [actions tab](https://github.com/actions/javascript-action/actions) for runs of this action! :rocket:

action.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
name: 'Wait'
2-
description: 'Wait a designated number of milliseconds'
1+
name: Git try push
2+
description: Try to push to remote repository specified number of times
3+
author: dawidd6
4+
branding:
5+
icon: arrow-up-circle
6+
color: blue
37
inputs:
4-
milliseconds: # id of input
5-
description: 'number of milliseconds to wait'
8+
token:
9+
description: Github token (used for push, not required if not needed)
10+
required: false
11+
tries:
12+
description: How many times to try pushing (defaults to 10)
613
required: true
7-
default: '1000'
8-
outputs:
9-
time: # output will be available to future steps
10-
description: 'The message to output'
14+
directory:
15+
description: Repository directory (defaults to current)
16+
required: false
1117
runs:
12-
using: 'node12'
13-
main: 'dist/index.js'
18+
using: node12
19+
main: main.js

0 commit comments

Comments
 (0)