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

v2.3.0 #674

Merged
merged 30 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
80541e6
feature: tests
joelwmale Nov 10, 2022
2d1fceb
feature: tests
joelwmale Nov 10, 2022
9b91251
feature: tests
joelwmale Nov 10, 2022
814998d
feature: additional tests
joelwmale Nov 10, 2022
c63a04a
build(deps): bump word-wrap from 1.2.3 to 1.2.4
dependabot[bot] Jul 18, 2023
3fba134
build(deps): bump node-fetch from 3.2.10 to 3.3.2
dependabot[bot] Jul 31, 2023
8900d16
build(deps-dev): bump @vercel/ncc from 0.34.0 to 0.38.0
dependabot[bot] Sep 11, 2023
189f0bb
Merge pull request #666 from joelwmale/dependabot/npm_and_yarn/vercel…
joelwmale Mar 25, 2024
defb03b
build(deps-dev): bump prettier from 2.7.1 to 3.2.5
dependabot[bot] Mar 25, 2024
daa9d1a
build(deps-dev): bump jest from 29.3.1 to 29.7.0
dependabot[bot] Mar 25, 2024
8f36e75
Merge pull request #673 from joelwmale/dependabot/npm_and_yarn/jest-2…
joelwmale Mar 28, 2024
a721dc5
Merge pull request #672 from joelwmale/dependabot/npm_and_yarn/pretti…
joelwmale Mar 28, 2024
6f9ad84
build(deps): bump @babel/traverse from 7.20.1 to 7.24.1
dependabot[bot] Mar 28, 2024
ecea37e
build(deps-dev): bump semver from 7.3.8 to 7.6.0
dependabot[bot] Mar 28, 2024
6df28dd
Merge pull request #671 from joelwmale/dependabot/npm_and_yarn/semver…
joelwmale Mar 28, 2024
369163b
build(deps-dev): bump eslint-plugin-github from 4.4.1 to 4.10.2
dependabot[bot] Mar 28, 2024
1cd54e2
Merge pull request #670 from joelwmale/dependabot/npm_and_yarn/eslint…
joelwmale Mar 28, 2024
49bf143
Merge pull request #669 from joelwmale/dependabot/npm_and_yarn/babel/…
joelwmale Mar 28, 2024
527b968
Merge pull request #660 from joelwmale/dependabot/npm_and_yarn/node-f…
joelwmale Mar 28, 2024
8561675
Merge pull request #657 from joelwmale/dependabot/npm_and_yarn/word-w…
joelwmale Mar 28, 2024
3cee2ba
feat: updates & github event support
joelwmale Mar 28, 2024
0de33a6
chore: update tests
joelwmale Mar 28, 2024
c54aaa0
chore: updating deps
joelwmale Mar 28, 2024
e58e495
chore: project cleanup
joelwmale Mar 28, 2024
534bb5e
feat: action updates
joelwmale Mar 28, 2024
34d5f15
chore: update actions
joelwmale Mar 28, 2024
3af123d
chore: fixing errors
joelwmale Mar 28, 2024
a976623
feat: fix syntax error
joelwmale Mar 28, 2024
14b045d
feat: finish updates & adding github event support
joelwmale Mar 28, 2024
6bfee79
v2.3.0
joelwmale Mar 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
dist
node_nodules
25 changes: 20 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
{
"env": {
"commonjs": true,
"node": true,
"es6": true,
"jest": true,
"node": true
"jest": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"jest",
"@typescript-eslint"
],
"extends": [
"plugin:github/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"github/no-then": "off",
"import/no-namespace": "off",
"i18n-text/no-en": "off"
}
}
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ updates:
directory: "/"
# Check the npm registry for updates every day (weekdays)
schedule:
interval: "daily"
interval: "weekly"
9 changes: 0 additions & 9 deletions .github/mergify.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Tests

on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
release:
types:
- created

jobs:
tests:
name: Tests
runs-on: ubuntu-20.04

strategy:
fail-fast: true
matrix:
node-version: [20.x]
stability: [prefer-stable]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile --${{ matrix.stability }}

- name: Execute tests
run: yarn test
54 changes: 1 addition & 53 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,53 +1 @@
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# DynamoDB Local files
.dynamodb/

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
node_modules/*
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Example:
url: ${{ secrets.WEBHOOK_URL }}
headers: '{"repository": "joelwmale/webhook-action"}'
body: '{"event": "deployment", "repository": "joelwmale/webhook-action"}'
github_event_payload: true
```

It is **highly** recommended to use the action is an explicit commit SHA-1:
Expand All @@ -34,11 +35,28 @@ The action has support for the following input variables (arguments):
* **`headers`** (**optional**): Any headers you want to be sent with the webhook
* **`body`** (**optional**): The body of data send with the webhook
* **`insecure`** (**optional**): Enables calling to known self-signed or invalid SSL certificates
* **`github_event_payload`** (**optional**): Enables forwarding the Github event payload to your webhook.

You can find more information on how to use these input variables below.

## Arguments

#### URL

**Required:** true

The URL to send the webhook to

```yml
url: ${{ secrets.WEBHOOK_URL }}
```

or

```yml
url: https://webhook.site/8b1b1b1b-8b1b-8b1b-8b1b-8b1b1b1b1b1b
```

#### Headers

**Required:** false
Expand All @@ -60,6 +78,30 @@ Allows you to send a custom JSON object to the webhook
body: '{"event": "deployment", "repository": "joelwmale/webhook-action"}'
```

#### Insecure

**Required:** false
**Default:** false

Allows you to send a webhook to a known self-signed or invalid SSL certificate

```yml
insecure: true
```

#### Github Event Payload

**Required:** false
**Default:** false

Allows you to send the Github event payload to your webhook

The payload will be sent as a JSON object under the key `githubEventPayload` on the root of the payload sent to your webhook

```yml
github_event_payload: true
```

## Issues

If you find any issues or have an improvement feel free to [submit an issue](https://github.com/joelwmale/webhook-action/issues/new)
Expand Down
31 changes: 31 additions & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {http} from '../src/http'
import {expect, test} from '@jest/globals'

test('it makes a post request', async () => {
const url = 'https://httpbin.org/post'
const body = '{"hello": "world"}'
const res = await http.make(url, body)
expect(res.status).toBe(200)
})

test('it makes a post request with insecure', async () => {
const url = 'https://httpbin.org/post'
const body = '{"hello": "world"}'
const insecure = true
const res = await http.make(url, body, null, insecure)
expect(res.status).toBe(200)
})

test('it makes a post request with headers', async () => {
const url = 'https://httpbin.org/post'
const body = '{"hello": "world"}'
const headers = '{"Content-Type": "application/json"}'
const res = await http.make(url, body, headers)
expect(res.status).toBe(200)
})

test('it doesnt require a body', async () => {
const url = 'https://httpbin.org/post'
const res = await http.make(url, null)
expect(res.status).toBe(200)
})
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ inputs:
insecure:
description: 'Enables calling to known self-signed or invalid SSL certificates'
required: false
github_event_payload:
description: 'Include the github event payload that triggered the action in the payload'
required: false
outputs:
status:
description: 'The status of the webhook event'
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
post: 'dist/index.js'
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {presets: ['@babel/preset-env']}