Skip to content

🚧 Test new inputs #11

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: 'CodeQL'
name: '🕵️ CodeQL'

on:
push:
branches: [main]
branches:
- main
pull_request:
# TODO: 🚧 Re-enable this before merging to main!
# The branches below must be a subset of the branches above
branches: [main]
# branches: [main]
schedule:
- cron: '31 7 * * 3'

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on: # rebuild any PRs and main branch changes
branches:
- main
- 'releases/*'
# TODO: 🚧 Remove this before merging!
- 'gkn/*'

jobs:
build: # make sure build/ci work properly
Expand All @@ -21,4 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: ./
with:
milliseconds: 1000
robots-txt: |
User-agent: *
Disallow: /
file-path: '/'
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
<p align="center">
<a href="https://github.com/remix-austin/update-robots-txt-github-action"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
<a href="https://github.com/remix-austin/update-robots-txt-github-action"><img alt="typescript-action status" src="https://github.com/remix-austin/update-robots-txt-github-action/.github/workflows/build-test/badge.svg"></a>
</p>

# Create a JavaScript Action using TypeScript

Use this template to bootstrap the creation of a TypeScript action.:rocket:

This template includes compilation support, tests, a validation workflow, publishing, and versioning guidance.

If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)

## Create an action from this template

Click the `Use this Template` and provide the new repo details for your action

## Code in Main
## Getting started

> First, you'll need to have a reasonably modern version of `node` handy. This won't work with versions older than 9, for instance.

Expand Down Expand Up @@ -43,15 +31,19 @@ $ npm test
...
```

## Change action.yml
---

## Developer Docs

### Change action.yml

The action.yml defines the inputs and output for your action.

Update the action.yml with your name, description, inputs and outputs for your action.

See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)

## Change the Code
### Change the Code

Most toolkit and CI/CD operations involve async operations so the action is run in an async function.

Expand All @@ -73,7 +65,7 @@ run()

See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.

## Publish to a distribution branch
### Publish to a distribution branch

Actions are run from GitHub repos so we will checkin the packed dist folder.

Expand All @@ -92,18 +84,19 @@ Your action is now published! :rocket:

See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)

## Validate
### Validate

You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml))

```yaml
uses: ./
with:
milliseconds: 1000
robots-txt: |
(your robots.txt content here)
```

See the [actions tab](https://github.com/remix-austin/update-robots-txt-github-action) for runs of this action! :rocket:

## Usage:
### Usage:

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
7 changes: 4 additions & 3 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import * as cp from 'child_process'
import * as path from 'path'
import {expect, test} from '@jest/globals'

test('throws invalid number', async () => {
// TODO: Delete these old test examples
test.skip('throws invalid number', async () => {
const input = parseInt('foo', 10)
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
})

test('wait 500 ms', async () => {
test.skip('wait 500 ms', async () => {
const start = new Date()
await wait(500)
const end = new Date()
Expand All @@ -18,7 +19,7 @@ test('wait 500 ms', async () => {
})

// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
test.skip('test runs', () => {
process.env['INPUT_MILLISECONDS'] = '500'
const np = process.execPath
const ip = path.join(__dirname, '..', 'lib', 'main.js')
Expand Down
10 changes: 7 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: 'Update robots.txt GitHub Action'
description: 'A custom GitHub Action for updating robots.txt'
author: 'Grant Norwood'
inputs:
milliseconds: # change this
robots-txt:
required: true
description: 'input description here'
default: 'default value if applicable'
description: 'The content of the robots.txt file you want to use for a deployment.'
default: ''
file-path:
required: true
description: 'The destination path for saving the robots.txt file.'
default: './'
runs:
using: 'node16'
main: 'dist/index.js'
Loading