diff --git a/content/actions/sharing-automations/creating-actions/creating-a-javascript-action.md b/content/actions/sharing-automations/creating-actions/creating-a-javascript-action.md index d77e0971f8e6..b660ce92fc13 100644 --- a/content/actions/sharing-automations/creating-actions/creating-a-javascript-action.md +++ b/content/actions/sharing-automations/creating-actions/creating-a-javascript-action.md @@ -39,6 +39,7 @@ Before you begin, you'll need to download Node.js and create a public {% data va 1. Download and install Node.js 20.x, which includes npm. https://nodejs.org/en/download/ + 1. Create a new public repository on {% data variables.product.github %} and call it "hello-world-javascript-action". For more information, see [AUTOTITLE](/repositories/creating-and-managing-repositories/creating-a-new-repository). 1. Clone your repository to your computer. For more information, see [AUTOTITLE](/repositories/creating-and-managing-repositories/cloning-a-repository). @@ -60,19 +61,22 @@ Before you begin, you'll need to download Node.js and create a public {% data va Create a new file named `action.yml` in the `hello-world-javascript-action` directory with the following example code. For more information, see [AUTOTITLE](/actions/creating-actions/metadata-syntax-for-github-actions). ```yaml copy -name: 'Hello World' -description: 'Greet someone and record the time' +name: Hello World +description: Greet someone and record the time + inputs: - who-to-greet: # id of input - description: 'Who to greet' + who-to-greet: # id of input + description: Who to greet required: true - default: 'World' + default: World + outputs: time: # id of output - description: 'The time we greeted you' + description: The time we greeted you + runs: - using: 'node20' - main: 'index.js' + using: node20 + main: dist/index.js ``` This file defines the `who-to-greet` input and `time` output. It also tells the action runner how to start running this JavaScript action. @@ -90,11 +94,10 @@ The toolkit offers more than the `core` and `github` packages. For more informat At your terminal, install the actions toolkit `core` and `github` packages. ```shell copy -npm install @actions/core -npm install @actions/github +npm install @actions/core @actions/github ``` -Now you should see a `node_modules` directory with the modules you just installed and a `package-lock.json` file with the installed module dependencies and the versions of each installed module. +You should now see a `node_modules` directory and a `package-lock.json` file which track any installed dependencies and their versions. You should not commit the `node_modules` directory to your repository. ## Writing the action code @@ -102,23 +105,26 @@ This action uses the toolkit to get the `who-to-greet` input variable required i GitHub Actions provide context information about the webhook event, Git refs, workflow, action, and the person who triggered the workflow. To access the context information, you can use the `github` package. The action you'll write will print the webhook event payload to the log. -Add a new file called `index.js`, with the following code. +Add a new file called `src/index.js`, with the following code. {% raw %} ```javascript copy -const core = require('@actions/core'); -const github = require('@actions/github'); +import * as core from "@actions/core"; +import * as github from "@actions/github"; try { // `who-to-greet` input defined in action metadata file - const nameToGreet = core.getInput('who-to-greet'); - console.log(`Hello ${nameToGreet}!`); - const time = (new Date()).toTimeString(); + const nameToGreet = core.getInput("who-to-greet"); + core.info(`Hello ${nameToGreet}!`); + + // Get the current time and set it as an output variable + const time = new Date().toTimeString(); core.setOutput("time", time); + // Get the JSON webhook payload for the event that triggered the workflow - const payload = JSON.stringify(github.context.payload, undefined, 2) - console.log(`The event payload: ${payload}`); + const payload = JSON.stringify(github.context.payload, undefined, 2); + core.info(`The event payload: ${payload}`); } catch (error) { core.setFailed(error.message); } @@ -142,7 +148,7 @@ In your `hello-world-javascript-action` directory, create a `README.md` file tha * An example of how to use your action in a workflow. ````markdown copy -# Hello world javascript action +# Hello world JavaScript action This action prints "Hello World" or "Hello" + the name of a person to greet to the log. @@ -163,54 +169,70 @@ The time we greeted you. ```yaml uses: actions/hello-world-javascript-action@e76147da8e5c81eaf017dede5645551d4b94427b with: - who-to-greet: 'Mona the Octocat' + who-to-greet: Mona the Octocat ``` ```` ## Commit, tag, and push your action -{% data variables.product.github %} downloads each action run in a workflow during runtime and executes it as a complete package of code before you can use workflow commands like `run` to interact with the runner machine. This means you must include any package dependencies required to run the JavaScript code. You'll need to check in the toolkit `core` and `github` packages to your action's repository. +{% data variables.product.github %} downloads each action run in a workflow during runtime and executes it as a complete package of code before you can use workflow commands like `run` to interact with the runner machine. This means you must include any package dependencies required to run the JavaScript code. For example, this action uses `@actions/core` and `@actions/github` packages. -From your terminal, commit your `action.yml`, `index.js`, `node_modules`, `package.json`, `package-lock.json`, and `README.md` files. If you added a `.gitignore` file that lists `node_modules`, you'll need to remove that line to commit the `node_modules` directory. +Checking in your `node_modules` directory can cause problems. As an alternative, you can use tools such as [`rollup.js`](https://github.com/rollup/rollup) or [`@vercel/ncc`](https://github.com/vercel/ncc) to combine your code and dependencies into one file for distribution. -It's best practice to also add a version tag for releases of your action. For more information on versioning your action, see [AUTOTITLE](/actions/creating-actions/about-custom-actions#using-release-management-for-actions). +1. Install `rollup` and its plugins by running this command in your terminal. -```shell copy -git add action.yml index.js node_modules/* package.json package-lock.json README.md -git commit -m "My first action is ready" -git tag -a -m "My first action release" v1.1 -git push --follow-tags -``` - -Checking in your `node_modules` directory can cause problems. As an alternative, you can use a tool called [`@vercel/ncc`](https://github.com/vercel/ncc) to compile your code and modules into one file used for distribution. + `npm install --save-dev rollup @rollup/plugin-commonjs @rollup/plugin-node-resolve` -1. Install `vercel/ncc` by running this command in your terminal. +1. Create a new file called `rollup.config.js` in the root of your repository with the following code. - `npm i -g @vercel/ncc` + ```javascript copy + import commonjs from "@rollup/plugin-commonjs"; + import { nodeResolve } from "@rollup/plugin-node-resolve"; -1. Compile your `index.js` file. + const config = { + input: "src/index.js", + output: { + esModule: true, + file: "dist/index.js", + format: "es", + sourcemap: true, + }, + plugins: [commonjs(), nodeResolve({ preferBuiltins: true })], + }; - `ncc build index.js --license licenses.txt` - - You'll see a new `dist/index.js` file with your code and the compiled modules. You will also see an accompanying `dist/licenses.txt` file containing all the licenses of the `node_modules` you are using. - -1. Change the `main` keyword in your `action.yml` file to use the new `dist/index.js` file. + export default config; + ``` - `main: 'dist/index.js'` +1. Compile your `dist/index.js` file. -1. If you already checked in your `node_modules` directory, remove it. + `rollup --config rollup.config.js` - `rm -rf node_modules/*` + You'll see a new `dist/index.js` file with your code and any dependencies. -1. From your terminal, commit the updates to your `action.yml`, `dist/index.js`, and `node_modules` files. +1. From your terminal, commit the updates. ```shell copy - git add action.yml dist/index.js node_modules/* - git commit -m "Use vercel/ncc" + git add src/index.js dist/index.js rollup.config.js package.json package-lock.json README.md action.yml + git commit -m "Initial commit of my first action" git tag -a -m "My first action release" v1.1 git push --follow-tags ``` +When you commit and push your code, your updated repository should look like this: + +```text +hello-world-javascript-action/ +├── action.yml +├── dist/ +│ └── index.js +├── package.json +├── package-lock.json +├── README.md +├── rollup.config.js +└── src/ + └── index.js +``` + ## Testing out your action in a workflow Now you're ready to test your action out in a workflow. @@ -228,18 +250,23 @@ Copy the following YAML into a new file at `.github/workflows/main.yml`, and upd {% raw %} ```yaml copy -on: [push] +on: + push: + branches: + - main jobs: hello_world_job: - runs-on: ubuntu-latest name: A job to say hello + runs-on: ubuntu-latest + steps: - name: Hello world action step id: hello uses: octocat/hello-world-javascript-action@1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b with: - who-to-greet: 'Mona the Octocat' + who-to-greet: Mona the Octocat + # Use the output from the `hello` step - name: Get the output time run: echo "The time was ${{ steps.hello.outputs.time }}" @@ -253,25 +280,29 @@ When this workflow is triggered, the runner will download the `hello-world-javas Copy the workflow code into a `.github/workflows/main.yml` file in your action's repository. You can also replace the `who-to-greet` input with your name. -**.github/workflows/main.yml** - ```yaml copy -on: [push] +on: + push: + branches: + - main jobs: hello_world_job: - runs-on: ubuntu-latest name: A job to say hello + runs-on: ubuntu-latest + steps: # To use this repository's private action, # you must check out the repository - name: Checkout uses: {% data reusables.actions.action-checkout %} + - name: Hello world action step uses: ./ # Uses an action in the root directory id: hello with: - who-to-greet: 'Mona the Octocat' + who-to-greet: Mona the Octocat + # Use the output from the `hello` step - name: Get the output time run: echo "The time was {% raw %}${{ steps.hello.outputs.time }}{% endraw %}" diff --git a/content/billing/managing-your-billing/preventing-overspending.md b/content/billing/managing-your-billing/preventing-overspending.md index ea6980fe77de..7b806bdfc8e8 100644 --- a/content/billing/managing-your-billing/preventing-overspending.md +++ b/content/billing/managing-your-billing/preventing-overspending.md @@ -131,6 +131,8 @@ As an {% data variables.enterprise.enterprise_or_org %} owner{% ifversion ghec % ### Editing or deleting a budget +>[!IMPORTANT] Deleting a budget may remove any limits on spending, depending on your other existing budgets. + {% ifversion fpt %} As an organization owner, you can edit or delete a budget at any time, but you cannot change the budget scope. diff --git a/content/copilot/using-github-copilot/copilot-chat/asking-github-copilot-questions-in-github.md b/content/copilot/using-github-copilot/copilot-chat/asking-github-copilot-questions-in-github.md index 41357cbaa0f8..9b794d1a4da1 100644 --- a/content/copilot/using-github-copilot/copilot-chat/asking-github-copilot-questions-in-github.md +++ b/content/copilot/using-github-copilot/copilot-chat/asking-github-copilot-questions-in-github.md @@ -20,7 +20,7 @@ redirect_from: {% data variables.copilot.copilot_chat_dotcom %} is a chat interface that lets you ask and receive answers to coding-related questions on the {% data variables.product.github %} website. -{% data variables.copilot.copilot_chat_short %} can help you with a variety of coding-related tasks, like offering you code suggestions, providing natural language descriptions of a piece of code's functionality and purpose, generating unit tests for your code, and proposing fixes for bugs in your code. For more information, see [AUTOTITLE](/copilot/github-copilot-chat/copilot-chat-in-github/about-github-copilot-chat-in-githubcom). +{% data variables.copilot.copilot_chat_short %} can help you with a variety of coding-related tasks, like offering you code suggestions, providing natural language descriptions of a piece of code's functionality and purpose, generating unit tests for your code, and proposing fixes for bugs in your code. On {% data variables.product.github %}, you can use {% data variables.copilot.copilot_chat_short %} to ask different questions in different contexts. For example, you can ask about a specific repository, a specific issue, or a specific pull request. You can also ask general questions about software development, or about a specific programming language. diff --git a/data/release-notes/enterprise-server/3-17/0.yml b/data/release-notes/enterprise-server/3-17/0.yml index 3284267a13b3..2ae5f24e73e4 100644 --- a/data/release-notes/enterprise-server/3-17/0.yml +++ b/data/release-notes/enterprise-server/3-17/0.yml @@ -207,7 +207,7 @@ sections: - | When publishing npm packages in a workflow after restoring from a backup to GitHub Enterprise Server 3.13.5.gm4 or 3.14.2.gm3, you may encounter a `401 Unauthorized` error from the GitHub Packages service. This can happen if the restore is from an N-1 or N-2 version and the workflow targets the npm endpoint on the backup instance. To avoid this issue, ensure the access token is valid and includes the correct scopes for publishing to GitHub Packages. - | - Uploading a new license with unbundled GitHub Advanced Security may not fully unbundle all the Security Configurations on the instance in certain cases. Any active Security Configurations will continue to function, but when attempting to apply the configurations to new repositories you may see errors like "Advanced Security is not purchased" or `Validation failed: Secret scanning non provider patterns Non-provider patterns must be disabled when secret scanning is disabled`. Contact GitHub Support for assistance clearing this state in version 3.17.0. This issue will be resolved in version 3.17.1. + Uploading a new license with unbundled GitHub Advanced Security may not fully unbundle all the Security Configurations on the instance in certain cases. Any active Security Configurations will continue to function, but when attempting to apply the configurations to new repositories you may see errors like "Advanced Security is not purchased" or `Validation failed: Secret scanning non provider patterns Non-provider patterns must be disabled when secret scanning is disabled`. Contact GitHub Support for assistance clearing this state in version 3.17.0. This issue will be resolved in version 3.17.2. closing_down: # https://github.com/github/releases/issues/5177 diff --git a/src/links/lib/excluded-links.yml b/src/links/lib/excluded-links.yml index f0000e8836b7..6002d3d16329 100644 --- a/src/links/lib/excluded-links.yml +++ b/src/links/lib/excluded-links.yml @@ -99,3 +99,4 @@ - is: https://www.tpgi.com/color-contrast-checker/ - startsWith: https://github.com/githubcustomers/enterprise-preview-program - is: https://aka.ms/copiloteclipse +- is: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1375604