Compare commits

...
45 Commits
Author SHA1 Message Date
Jonathan Clem 3c58ce3675 v3.0.2 2020-11-17 08:43:24 -05:00
Jonathan Clem ff0a9e81a8 v3.0.1 2020-11-17 08:11:47 -05:00
Jonathan Clem 9d620e45a4 Merge pull request #98 from hfaulds/core-1.2.6
Bump @actions/core from 1.2.4 to 1.2.6 dependencies
2020-11-17 08:06:58 -05:00
Hayden Faulds e5156a8b84 rebuild distribution 2020-11-17 11:19:50 +00:00
Hayden Faulds b780942434 update licenses 2020-11-17 11:19:43 +00:00
Jonathan Clem f035cea467 Merge pull request #95 from pradyunsg/patch-1
Move information about diffs to correct heading
2020-11-02 12:25:15 -05:00
Pradyun Gedam 6bd37e1a50 Move information about diffs to correct heading 2020-10-31 19:18:40 +05:30
dependabot[bot] 9124ee04c3 Bump @actions/core from 1.2.4 to 1.2.6
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.4 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-05 17:44:36 +00:00
Jonathan Clem 28e5ebafd7 Update README.md 2020-10-05 13:43:31 -04:00
Jonathan Clem ce5d26b1ab Merge pull request #88 from clarkbw/patch-1
Add a GraphQL example to the README
2020-09-21 09:53:37 -04:00
Bryan Clark 91121b9cb3 Fixup typo 2020-09-17 12:58:40 -07:00
Bryan Clark ac77fc9f3f Add a GraphQL example 2020-09-17 12:57:34 -07:00
Jonathan Clem eb58336601 Merge pull request #86 from actions/fix-readme-args-example
Fix example function arguments in README
2020-09-01 09:44:23 -04:00
Jonathan Clem af3c0bbd72 Fix example function arguments 2020-09-01 09:42:22 -04:00
Jonathan Clem fdf4916d13 Merge pull request #84 from victoriadrake/patch-1
Clean up README
2020-08-27 16:20:53 -04:00
Victoria Drake 89e42e73d1 Clean up README
Remove text that seems to be repeated
2020-08-22 09:25:58 -04:00
Jonathan Clem e2ddba4dfc Fix Integration/CI badges 2020-08-21 11:15:59 -04:00
Jonathan Clem cf1dcb0bd5 Add nicer status badges and workflow names 2020-08-21 11:13:16 -04:00
Jonathan Clem 626af12fe9 v3.0.0 2020-08-21 11:04:01 -04:00
Jonathan Clem 79d44e3558 Merge pull request #83 from actions/bump-deps
Bump dependencies
2020-08-21 11:01:07 -04:00
Jonathan Clem 11dbe182e4 Update licenses 2020-08-21 10:59:43 -04:00
Jonathan Clem 563cb72ab7 Bump dev dependencies 2020-08-21 10:58:31 -04:00
Jonathan Clem 3c682f9960 Bump production dependencies 2020-08-21 10:54:17 -04:00
Jonathan Clem fc4d627901 Add stale workflow 2020-08-18 09:35:23 -04:00
Jonathan Clem d77e8e702f Update issue templates 2020-08-18 09:01:03 -04:00
Jonathan Clem fb0feb9324 Add licensed workflow badge 2020-08-06 21:26:37 -04:00
Jonathan Clem 21ae42ffb7 Merge pull request #80 from actions/dependabot/npm_and_yarn/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19
2020-08-06 21:20:46 -04:00
dependabot[bot] 408aa6532b Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-07 01:19:18 +00:00
Jonathan Clem 44b873bc97 v2.0.1 2020-08-06 21:11:50 -04:00
Jonathan Clem b92989f423 Mark licenses as generated 2020-08-06 21:05:36 -04:00
Jonathan Clem 5e49adabf5 Merge pull request #79 from actions/licensed
Add production licenses with licensed
2020-08-06 21:04:42 -04:00
Jonathan Clem 4db7989ab1 Add a licensed workflow 2020-08-06 20:31:06 -04:00
Jonathan Clem a4a34d1dea Add production licenses with licensed 2020-08-06 20:27:06 -04:00
Jonathan Clem 3f9262325d Merge pull request #74 from ahmadnassri/patch-1
docs: use GITHUB_WORKSPACE environment variable
2020-07-29 11:49:55 -04:00
Jonathan Clem 07ecbc5ac0 Update README.md 2020-07-29 11:49:45 -04:00
Ahmad Nassri a656f437f9 docs: use GITHUB_WORKSPACE environment variable
- update example for using `GITHUB_WORKSPACE` environment variable to keep things simple, and use less steps
- include `github` object as a parameter to the sample script to better illustrate usage
2020-07-28 21:54:19 -04:00
Jonathan Clem 83107c8695 Merge pull request #67 from j-ulrich/j-ulrich-absolute-path-note
Adds note that absolute path is required
2020-07-17 10:26:39 -04:00
Jonathan Clem 603dfa3ce2 Update README.md 2020-07-17 10:25:55 -04:00
Jonathan Clem 62c8044fd6 Update README.md 2020-07-17 10:25:39 -04:00
Jochen Ulrich c19d6ba8b3 Adds note that absolute path is required
An absolute path is required when calling `require()` from within the github-script
2020-07-17 00:47:14 +02:00
Jonathan Clem 1ba1e95cf2 Replace default branch name with main 2020-07-14 16:36:10 -04:00
Jonathan Clem b507739f17 Merge pull request #62 from advayDev1/patch-1
Link to correct context file
2020-07-09 11:05:26 -04:00
Advay Mengle 95130f1202 Link to correct context file 2020-07-07 20:26:05 -07:00
Jonathan Clem 82b33c82ef Merge pull request #59 from actions/add-octokit-deps
Add Octokit deps directly
2020-06-08 18:20:08 -04:00
Jonathan Clem 53cd48b63b Add Octokit deps directly 2020-06-08 18:17:07 -04:00
36 changed files with 6100 additions and 8253 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
.licenses/** -diff linguist-generated=true
+38
View File
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+4 -2
View File
@@ -1,6 +1,8 @@
name: CI
on: on:
push: {branches: master} push: {branches: main}
pull_request: {branches: master} pull_request: {branches: main}
jobs: jobs:
ci: ci:
+4 -2
View File
@@ -1,12 +1,14 @@
name: Integration
on: on:
push: {branches: master} push: {branches: main}
jobs: jobs:
integration: integration:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- id: output-set - id: output-set
uses: actions/github-script@master uses: actions/github-script@main
with: with:
script: return core.getInput('input-value') script: return core.getInput('input-value')
result-encoding: string result-encoding: string
+27
View File
@@ -0,0 +1,27 @@
name: Licensed
on:
push: {branches: main}
pull_request: {branches: main}
repository_dispatch:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
name: Check licenses
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- name: Install licensed
run: |-
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.9.2/licensed-2.9.2-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status
+1 -1
View File
@@ -1,6 +1,6 @@
on: on:
pull_request: pull_request:
branches: master branches: main
types: [opened, synchronize] types: [opened, synchronize]
jobs: jobs:
+31
View File
@@ -0,0 +1,31 @@
name: Stale Issues & PRs
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
mark_stale:
name: Mark issues and PRs as stale
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
exempt-issue-labels: Not Stale
exempt-pr-labels: Not Stale
stale-issue-message: >
This issue is stale because it has been open for 60 days with no
activity. Remove the "Stale" label or comment on the issue, or it
will be closed in 7 days.
stale-pr-message: >
This pull request is stale because it has been open for 60 days
with no activity. Remove the "Stale" label or comment on the pull
request, or it will be closed in 7 days.
close-issue-message: >
This issue has been marked as stale and closed due to no activity
on it.
close-pr-message: >
This pull request has been marked as stale and closed due to no
activity on it.
+14
View File
@@ -0,0 +1,14 @@
sources:
npm: true
allowed:
- apache-2.0
- bsd-2-clause
- bsd-3-clause
- isc
- mit
- cc0-1.0
- unlicense
reviewed:
npm:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+53 -15
View File
@@ -1,4 +1,8 @@
# github-script ![.github/workflows/integration.yml](https://github.com/actions/github-script/workflows/.github/workflows/integration.yml/badge.svg?event=push) ![.github/workflows/ci.yml](https://github.com/actions/github-script/workflows/.github/workflows/ci.yml/badge.svg?event=push) # actions/github-script
[![.github/workflows/integration.yml](https://github.com/actions/github-script/workflows/Integration/badge.svg?event=push&branch=main)](https://github.com/actions/github-script/actions?query=workflow%3AIntegration+branch%3Amain+event%3Apush)
[![.github/workflows/ci.yml](https://github.com/actions/github-script/workflows/CI/badge.svg?event=push&branch=main)](https://github.com/actions/github-script/actions?query=workflow%3ACI+branch%3Amain+event%3Apush)
[![.github/workflows/licensed.yml](https://github.com/actions/github-script/workflows/Licensed/badge.svg?event=push&branch=main)](https://github.com/actions/github-script/actions?query=workflow%3ALicensed+branch%3Amain+event%3Apush)
This action makes it easy to quickly write a script in your workflow that This action makes it easy to quickly write a script in your workflow that
uses the GitHub API and the workflow run context. uses the GitHub API and the workflow run context.
@@ -8,11 +12,11 @@ input should be the body of an asynchronous function call. The following
arguments will be provided: arguments will be provided:
- `github` A pre-authenticated - `github` A pre-authenticated
[octokit/rest.js](https://github.com/octokit/rest.js) client [octokit/core.js](https://github.com/octokit/core.js#readme) client with REST endpoints and pagination plugins
- `context` An object containing the [context of the workflow - `context` An object containing the [context of the workflow
run](https://github.com/actions/toolkit/tree/master/packages/github) run](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts)
- `core` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/master/packages/core) package - `core` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/main/packages/core) package
- `io` A reference to the [@actions/io](https://github.com/actions/toolkit/tree/master/packages/io) package - `io` A reference to the [@actions/io](https://github.com/actions/toolkit/tree/main/packages/io) package
Since the `script` is just a function body, these values will already be Since the `script` is just a function body, these values will already be
defined, so you don't have to (see examples below). defined, so you don't have to (see examples below).
@@ -33,7 +37,7 @@ The return value of the script will be in the step's outputs under the
"result" key. "result" key.
```yaml ```yaml
- uses: actions/github-script@v2 - uses: actions/github-script@v3
id: set-result id: set-result
with: with:
script: return "Hello!" script: return "Hello!"
@@ -52,7 +56,7 @@ output of a github-script step. For some workflows, string encoding is preferred
`result-encoding` input: `result-encoding` input:
```yaml ```yaml
- uses: actions/github-script@v2 - uses: actions/github-script@v3
id: my-script id: my-script
with: with:
github-token: ${{secrets.GITHUB_TOKEN}} github-token: ${{secrets.GITHUB_TOKEN}}
@@ -78,7 +82,7 @@ jobs:
comment: comment:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v2 - uses: actions/github-script@v3
with: with:
github-token: ${{secrets.GITHUB_TOKEN}} github-token: ${{secrets.GITHUB_TOKEN}}
script: | script: |
@@ -101,7 +105,7 @@ jobs:
apply-label: apply-label:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v2 - uses: actions/github-script@v3
with: with:
github-token: ${{secrets.GITHUB_TOKEN}} github-token: ${{secrets.GITHUB_TOKEN}}
script: | script: |
@@ -122,7 +126,7 @@ jobs:
welcome: welcome:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v2 - uses: actions/github-script@v3
with: with:
github-token: ${{secrets.GITHUB_TOKEN}} github-token: ${{secrets.GITHUB_TOKEN}}
script: | script: |
@@ -166,7 +170,7 @@ jobs:
diff: diff:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v2 - uses: actions/github-script@v3
with: with:
github-token: ${{secrets.GITHUB_TOKEN}} github-token: ${{secrets.GITHUB_TOKEN}}
script: | script: |
@@ -182,6 +186,39 @@ using the API.)_
This will print the full diff object in the screen; `result.data` will This will print the full diff object in the screen; `result.data` will
contain the actual diff text. contain the actual diff text.
### Run custom GraphQL queries
You can use the `github.graphql` object to run custom GraphQL queries against the GitHub API.
```yaml
jobs:
list-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const query = `query($owner:String!, $name:String!) {
repository(owner:$owner, name:$name){
issues(first:100, labels: [$label]) {
nodes {
id
}
}
}
}`;
const variables = {
owner: context.repo.owner,
name: context.repo.repo,
label: 'wontfix'
}
const result = await github.graphql(query, variables)
console.log(result)
```
### Run a separate file ### Run a separate file
If you don't want to inline your entire script that you want to run, you can If you don't want to inline your entire script that you want to run, you can
@@ -198,15 +235,16 @@ jobs:
- uses: actions/github-script@v2 - uses: actions/github-script@v2
with: with:
script: | script: |
const path = require('path') const script = require(`${process.env.GITHUB_WORKSPACE}/path/to/script.js`)
const scriptPath = path.resolve('./path/to/script.js') console.log(script({github, context}))
console.log(require(scriptPath)({context}))
``` ```
_Note that the script path given to `require()` must be an **absolute path** in this case, hence using [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables)._
And then export a function from your module: And then export a function from your module:
```javascript ```javascript
module.exports = ({context}) => { module.exports = ({github, context}) => {
return context.payload.client_payload.value return context.payload.client_payload.value
} }
``` ```
+3193 -6849
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -25,4 +25,4 @@ Releases are done manually, for now:
1. Ensure that the build is up to date with `npm run build`. 1. Ensure that the build is up to date with `npm run build`.
1. Bump the [package.json](/package.json#L3) and [package-lock.json](/package-lock.json#L3) version numbers and commit them. 1. Bump the [package.json](/package.json#L3) and [package-lock.json](/package-lock.json#L3) version numbers and commit them.
1. Update documentation (including updated version numbers). 1. Update documentation (including updated version numbers).
1. Tag master with the new version number and create a GitHub release. 1. Tag main with the new version number and create a GitHub release.
+2698 -1371
View File
File diff suppressed because it is too large. Load diff
+15 -12
View File
@@ -1,7 +1,7 @@
{ {
"name": "github-script", "name": "github-script",
"description": "A GitHub action for executing a simple script", "description": "A GitHub action for executing a simple script",
"version": "2.0.0", "version": "3.0.2",
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",
@@ -35,22 +35,25 @@
} }
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.2.4", "@actions/core": "^1.2.6",
"@actions/github": "^3.0.0", "@actions/github": "^4.0.0",
"@actions/io": "^1.0.2" "@actions/io": "^1.0.2",
"@octokit/core": "^3.1.2",
"@octokit/plugin-paginate-rest": "^2.3.0",
"@octokit/plugin-rest-endpoint-methods": "^4.1.2"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^25.1.4", "@types/jest": "^26.0.10",
"@typescript-eslint/eslint-plugin": "^2.33.0", "@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^2.33.0", "@typescript-eslint/parser": "^3.9.1",
"@zeit/ncc": "^0.22.0", "@vercel/ncc": "^0.23.0",
"eslint": "^7.0.0", "eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^6.11.0",
"husky": "^4.2.5", "husky": "^4.2.5",
"jest": "^25.1.0", "jest": "^26.4.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^2.0.5", "prettier": "^2.0.5",
"ts-jest": "^25.2.1", "ts-jest": "^26.2.0",
"typescript": "^3.8.3" "typescript": "^4.0.2"
} }
} }