Skip to content

Commit 4cf9b02

Browse files
committed
2 parents e4836e9 + d110eee commit 4cf9b02

File tree

1 file changed

+2
-304
lines changed

1 file changed

+2
-304
lines changed

README.md

Lines changed: 2 additions & 304 deletions
Original file line numberDiff line numberDiff line change
@@ -1,305 +1,3 @@
1-
# Create a GitHub Action Using TypeScript
1+
# GitHub Agentic Workflows MCP Proxy Action
22

3-
![Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)
4-
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)
5-
![Check dist/](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml/badge.svg)
6-
![CodeQL](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml/badge.svg)
7-
![Coverage](./badges/coverage.svg)
8-
9-
Use this template to bootstrap the creation of a TypeScript action. :rocket:
10-
11-
This template includes compilation support, tests, a validation workflow,
12-
publishing, and versioning guidance.
13-
14-
If you are new, there's also a simpler introduction in the
15-
[Hello world JavaScript action repository](https://github.com/actions/hello-world-javascript-action).
16-
17-
## Create Your Own Action
18-
19-
To create your own action, you can use this repository as a template! Just
20-
follow the below instructions:
21-
22-
1. Click the **Use this template** button at the top of the repository
23-
1. Select **Create a new repository**
24-
1. Select an owner and name for your new repository
25-
1. Click **Create repository**
26-
1. Clone your new repository
27-
28-
> [!IMPORTANT]
29-
>
30-
> Make sure to remove or update the [`CODEOWNERS`](./CODEOWNERS) file! For
31-
> details on how to use this file, see
32-
> [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners).
33-
34-
## Initial Setup
35-
36-
After you've cloned the repository to your local machine or codespace, you'll
37-
need to perform some initial setup steps before you can develop your action.
38-
39-
> [!NOTE]
40-
>
41-
> You'll need to have a reasonably modern version of
42-
> [Node.js](https://nodejs.org) handy (20.x or later should work!). If you are
43-
> using a version manager like [`nodenv`](https://github.com/nodenv/nodenv) or
44-
> [`fnm`](https://github.com/Schniz/fnm), this template has a `.node-version`
45-
> file at the root of the repository that can be used to automatically switch to
46-
> the correct version when you `cd` into the repository. Additionally, this
47-
> `.node-version` file is used by GitHub Actions in any `actions/setup-node`
48-
> actions.
49-
50-
1. :hammer_and_wrench: Install the dependencies
51-
52-
```bash
53-
npm install
54-
```
55-
56-
1. :building_construction: Package the TypeScript for distribution
57-
58-
```bash
59-
npm run bundle
60-
```
61-
62-
1. :white_check_mark: Run the tests
63-
64-
```bash
65-
$ npm test
66-
67-
PASS ./index.test.js
68-
✓ throws invalid number (3ms)
69-
wait 500 ms (504ms)
70-
test runs (95ms)
71-
72-
...
73-
```
74-
75-
## Update the Action Metadata
76-
77-
The [`action.yml`](action.yml) file defines metadata about your action, such as
78-
input(s) and output(s). For details about this file, see
79-
[Metadata syntax for GitHub Actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions).
80-
81-
When you copy this repository, update `action.yml` with the name, description,
82-
inputs, and outputs for your action.
83-
84-
## Update the Action Code
85-
86-
The [`src/`](./src/) directory is the heart of your action! This contains the
87-
source code that will be run when your action is invoked. You can replace the
88-
contents of this directory with your own code.
89-
90-
There are a few things to keep in mind when writing your action code:
91-
92-
- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
93-
In `main.ts`, you will see that the action is run in an `async` function.
94-
95-
```javascript
96-
import * as core from '@actions/core'
97-
//...
98-
99-
async function run() {
100-
try {
101-
//...
102-
} catch (error) {
103-
core.setFailed(error.message)
104-
}
105-
}
106-
```
107-
108-
For more information about the GitHub Actions toolkit, see the
109-
[documentation](https://github.com/actions/toolkit/blob/main/README.md).
110-
111-
So, what are you waiting for? Go ahead and start customizing your action!
112-
113-
1. Create a new branch
114-
115-
```bash
116-
git checkout -b releases/v1
117-
```
118-
119-
1. Replace the contents of `src/` with your action code
120-
1. Add tests to `__tests__/` for your source code
121-
1. Format, test, and build the action
122-
123-
```bash
124-
npm run all
125-
```
126-
127-
> This step is important! It will run [`rollup`](https://rollupjs.org/) to
128-
> build the final JavaScript action code with all dependencies included. If
129-
> you do not run this step, your action will not work correctly when it is
130-
> used in a workflow.
131-
132-
1. (Optional) Test your action locally
133-
134-
The [`@github/local-action`](https://github.com/github/local-action) utility
135-
can be used to test your action locally. It is a simple command-line tool
136-
that "stubs" (or simulates) the GitHub Actions Toolkit. This way, you can run
137-
your TypeScript action locally without having to commit and push your changes
138-
to a repository.
139-
140-
The `local-action` utility can be run in the following ways:
141-
- Visual Studio Code Debugger
142-
143-
Make sure to review and, if needed, update
144-
[`.vscode/launch.json`](./.vscode/launch.json)
145-
146-
- Terminal/Command Prompt
147-
148-
```bash
149-
# npx @github/local action <action-yaml-path> <entrypoint> <dotenv-file>
150-
npx @github/local-action . src/main.ts .env
151-
```
152-
153-
You can provide a `.env` file to the `local-action` CLI to set environment
154-
variables used by the GitHub Actions Toolkit. For example, setting inputs and
155-
event payload data used by your action. For more information, see the example
156-
file, [`.env.example`](./.env.example), and the
157-
[GitHub Actions Documentation](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables).
158-
159-
1. Commit your changes
160-
161-
```bash
162-
git add .
163-
git commit -m "My first action is ready!"
164-
```
165-
166-
1. Push them to your repository
167-
168-
```bash
169-
git push -u origin releases/v1
170-
```
171-
172-
1. Create a pull request and get feedback on your action
173-
1. Merge the pull request into the `main` branch
174-
175-
Your action is now published! :rocket:
176-
177-
For information about versioning your action, see
178-
[Versioning](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md)
179-
in the GitHub Actions toolkit.
180-
181-
## Validate the Action
182-
183-
You can now validate the action by referencing it in a workflow file. For
184-
example, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an
185-
action in the same repository.
186-
187-
```yaml
188-
steps:
189-
- name: Checkout
190-
id: checkout
191-
uses: actions/checkout@v4
192-
193-
- name: Test Local Action
194-
id: test-action
195-
uses: ./
196-
with:
197-
milliseconds: 1000
198-
199-
- name: Print Output
200-
id: output
201-
run: echo "${{ steps.test-action.outputs.time }}"
202-
```
203-
204-
For example workflow runs, check out the
205-
[Actions tab](https://github.com/actions/typescript-action/actions)! :rocket:
206-
207-
## Usage
208-
209-
After testing, you can create version tag(s) that developers can use to
210-
reference different stable versions of your action. For more information, see
211-
[Versioning](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md)
212-
in the GitHub Actions toolkit.
213-
214-
To include the action in a workflow in another repository, you can use the
215-
`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit
216-
hash.
217-
218-
```yaml
219-
steps:
220-
- name: Checkout
221-
id: checkout
222-
uses: actions/checkout@v4
223-
224-
- name: Test Local Action
225-
id: test-action
226-
uses: actions/typescript-action@v1 # Commit with the `v1` tag
227-
with:
228-
milliseconds: 1000
229-
230-
- name: Print Output
231-
id: output
232-
run: echo "${{ steps.test-action.outputs.time }}"
233-
```
234-
235-
## Publishing a New Release
236-
237-
This project includes a helper script, [`script/release`](./script/release)
238-
designed to streamline the process of tagging and pushing new releases for
239-
GitHub Actions.
240-
241-
GitHub Actions allows users to select a specific version of the action to use,
242-
based on release tags. This script simplifies this process by performing the
243-
following steps:
244-
245-
1. **Retrieving the latest release tag:** The script starts by fetching the most
246-
recent SemVer release tag of the current branch, by looking at the local data
247-
available in your repository.
248-
1. **Prompting for a new release tag:** The user is then prompted to enter a new
249-
release tag. To assist with this, the script displays the tag retrieved in
250-
the previous step, and validates the format of the inputted tag (vX.X.X). The
251-
user is also reminded to update the version field in package.json.
252-
1. **Tagging the new release:** The script then tags a new release and syncs the
253-
separate major tag (e.g. v1, v2) with the new release tag (e.g. v1.0.0,
254-
v2.1.2). When the user is creating a new major release, the script
255-
auto-detects this and creates a `releases/v#` branch for the previous major
256-
version.
257-
1. **Pushing changes to remote:** Finally, the script pushes the necessary
258-
commits, tags and branches to the remote repository. From here, you will need
259-
to create a new release in GitHub so users can easily reference the new tags
260-
in their workflows.
261-
262-
## Dependency License Management
263-
264-
This template includes a GitHub Actions workflow,
265-
[`licensed.yml`](./.github/workflows/licensed.yml), that uses
266-
[Licensed](https://github.com/licensee/licensed) to check for dependencies with
267-
missing or non-compliant licenses. This workflow is initially disabled. To
268-
enable the workflow, follow the below steps.
269-
270-
1. Open [`licensed.yml`](./.github/workflows/licensed.yml)
271-
1. Uncomment the following lines:
272-
273-
```yaml
274-
# pull_request:
275-
# branches:
276-
# - main
277-
# push:
278-
# branches:
279-
# - main
280-
```
281-
282-
1. Save and commit the changes
283-
284-
Once complete, this workflow will run any time a pull request is created or
285-
changes pushed directly to `main`. If the workflow detects any dependencies with
286-
missing or non-compliant licenses, it will fail the workflow and provide details
287-
on the issue(s) found.
288-
289-
### Updating Licenses
290-
291-
Whenever you install or update dependencies, you can use the Licensed CLI to
292-
update the licenses database. To install Licensed, see the project's
293-
[Readme](https://github.com/licensee/licensed?tab=readme-ov-file#installation).
294-
295-
To update the cached licenses, run the following command:
296-
297-
```bash
298-
licensed cache
299-
```
300-
301-
To check the status of cached licenses, run the following command:
302-
303-
```bash
304-
licensed status
305-
```
3+
This GitHub Custom Action is responsible for mounting an MCP behing a HTTP transport to isolate the MCP from the main container.

0 commit comments

Comments
 (0)