Compare commits

..

24 Commits

Author SHA1 Message Date
James M. Greene
75c1124b14 Merge pull request #67 from actions/release-process-updates
Update release process in README
2022-09-26 15:45:28 -05:00
James M. Greene
766cde6ce5 Merge branch 'main' into release-process-updates 2022-09-26 15:43:11 -05:00
James M. Greene
1352fce070 Merge pull request #65 from actions/unused-deps
Clean up some unused dependencies
2022-09-26 15:37:52 -05:00
James M. Greene
12ecc67b1a Remove unnecessary Jest config 2022-09-26 15:30:15 -05:00
James M. Greene
b388ef8bf2 Remove unnecessary first-party use of Regenerator 2022-09-26 14:47:48 -05:00
James M. Greene
818dc836a0 Merge branch 'main' into unused-deps 2022-09-26 14:34:08 -05:00
James M. Greene
60e36109df Merge pull request #64 from actions/eslint-roller
Update ESLint config and expand usage
2022-09-26 14:12:25 -05:00
James M. Greene
7098b54017 Merge branch 'main' into eslint-roller 2022-09-26 14:10:15 -05:00
James M. Greene
539d415250 Merge pull request #63 from actions/i-feel-prettier
Expand Prettier usage
2022-09-26 14:08:33 -05:00
James M. Greene
af51f9ed91 Update release process in README 2022-09-19 10:53:48 -05:00
James M. Greene
6e7a81b68f Revise linter Actions workflow 2022-09-16 23:16:38 -05:00
James M. Greene
6bbc94d747 Remove unused deps related to Babel 2022-09-16 23:14:27 -05:00
James M. Greene
20ece23417 Remove unused packages 2022-09-16 23:10:54 -05:00
James M. Greene
503d9f28e7 Remove redundant require for global variables 2022-09-16 23:05:43 -05:00
James M. Greene
f8491fe25c Enhance ESLint configuration 2022-09-16 22:59:17 -05:00
James M. Greene
de75c272ff Expand ESLint usage and add check script 2022-09-16 22:52:58 -05:00
James M. Greene
5e811dcf4c Sort scripts alphabetically 2022-09-16 22:52:36 -05:00
James M. Greene
f14d75a58d Reformat all the things 2022-09-16 22:39:00 -05:00
James M. Greene
2727d0f5db Reorder dependencies alphabetically 2022-09-16 22:37:54 -05:00
James M. Greene
67de43d94c Remove unused dependency 2022-09-16 22:37:33 -05:00
James M. Greene
1996917397 Expand Prettier coverage 2022-09-16 22:36:35 -05:00
Jess Bees
44d4246912 Merge pull request #62 from actions/pages/get-build-conclusion
Add optional 'conclusion' argument to emitTelemetry
2022-09-16 09:33:36 -04:00
Jess Bees
5de668770e Gotta update npm deps to accurately compile it 2022-09-15 13:05:09 -04:00
Jess Bees
1c52af2b34 Add optional 'conclusion' argument to emitTelemetry
If present, will include the value of `conclusion` with the telemetry
POST body (gh/gh needs a separate PR to recognize this)
2022-09-15 12:14:23 -04:00
25 changed files with 301 additions and 2647 deletions

View File

@@ -1,2 +0,0 @@
node_modules/
dist/

View File

@@ -1,19 +1,17 @@
{ {
"env": { "env": {
"commonjs": true, "commonjs": true,
"es6": true, "es2021": true,
"jest": true, "node": true,
"node": true "jest": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
}, },
"plugins": ["github"],
"extends": ["eslint:recommended", "prettier", "plugin:github/internal"],
"parserOptions": { "parserOptions": {
"ecmaVersion": 2020 "ecmaVersion": 12
}, },
"rules": { "rules": {
"semi": ["error", "never"] "semi": ["error", "never"]
} },
"ignorePatterns": ["/dist/", "/pre/"]
} }

View File

@@ -1,6 +1,6 @@
--- ---
name-template: "v$RESOLVED_VERSION" name-template: 'v$RESOLVED_VERSION'
tag-template: "v$RESOLVED_VERSION" tag-template: 'v$RESOLVED_VERSION'
template: | template: |
# Changelog # Changelog
@@ -8,33 +8,33 @@ template: |
See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release. See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release.
categories: categories:
- title: "🚀 Features" - title: '🚀 Features'
labels: labels:
- "feature" - 'feature'
- "enhancement" - 'enhancement'
- title: "🐛 Bug Fixes" - title: '🐛 Bug Fixes'
labels: labels:
- "fix" - 'fix'
- "bugfix" - 'bugfix'
- "bug" - 'bug'
- title: "🧰 Maintenance" - title: '🧰 Maintenance'
labels: labels:
- "infrastructure" - 'infrastructure'
- "automation" - 'automation'
- "documentation" - 'documentation'
- title: "🏎 Performance" - title: '🏎 Performance'
label: "performance" label: 'performance'
change-template: "- $TITLE @$AUTHOR (#$NUMBER)" change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
version-resolver: version-resolver:
major: major:
labels: labels:
- "type: breaking" - 'type: breaking'
minor: minor:
labels: labels:
- "type: enhancement" - 'type: enhancement'
patch: patch:
labels: labels:
- "type: bug" - 'type: bug'
- "type: maintenance" - 'type: maintenance'
- "type: documentation" - 'type: documentation'
default: patch default: patch

View File

@@ -1,4 +1,4 @@
name: Checking linter name: Check linter
on: on:
push: push:
@@ -31,4 +31,4 @@ jobs:
run: npm ci run: npm ci
- name: Verify linter - name: Verify linter
run: npm run lint run: npm run lint:check

View File

@@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of # the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages. # supported CodeQL languages.
# #
name: "CodeQL" name: 'CodeQL'
on: on:
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [ main ] branches: [main]
schedule: schedule:
- cron: '40 0 * * 1' - cron: '40 0 * * 1'
@@ -32,7 +32,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'javascript' ] language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support # Learn more about CodeQL language support at https://git.io/codeql-language-support

View File

@@ -5,7 +5,7 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
TAG_NAME: TAG_NAME:
description: "Tag name that the major tag will point to" description: 'Tag name that the major tag will point to'
required: true required: true
env: env:

View File

@@ -1 +1,6 @@
node_modules/ # Ignore build artifacts
/dist/
/pre/
# Ignore all Markdown files
*.md

View File

@@ -66,9 +66,11 @@ There are a few important considerations to be aware of:
In order to release a new version of this Action: In order to release a new version of this Action:
1. Publish the draft release from the `main` branch with semantic version as the tag name, _with_ the checkbox to publish to the GitHub Marketplace checked. :ballot_box_with_check: 1. Locate the semantic version of the [upcoming release][release-list] (a draft is maintained by the [`draft-release` workflow][draft-release]).
2. After publishing the release, the [`release` workflow][release] will automatically run to create/update the corresponding the major version tag such as `v1`. 2. Publish the draft release from the `main` branch with semantic version as the tag name, _with_ the checkbox to publish to the GitHub Marketplace checked. :ballot_box_with_check:
3. After publishing the release, the [`release` workflow][release] will automatically run to create/update the corresponding the major version tag such as `v1`.
⚠️ Environment approval is required. Check the [Release workflow run list][release-workflow-runs]. ⚠️ Environment approval is required. Check the [Release workflow run list][release-workflow-runs].
@@ -81,5 +83,7 @@ The scripts and documentation in this project are released under the [MIT Licens
[upload-pages-artifact]: https://github.com/actions/upload-pages-artifact [upload-pages-artifact]: https://github.com/actions/upload-pages-artifact
[artifacts]: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts [artifacts]: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
[environment-protection]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-protection-rules [environment-protection]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-protection-rules
[release-list]: https://github.com/actions/deploy-pages/releases
[draft-release]: .github/workflows/draft-release.yml
[release]: .github/workflows/release.yml [release]: .github/workflows/release.yml
[release-workflow-runs]: https://github.com/actions/deploy-pages/actions/workflows/release.yml [release-workflow-runs]: https://github.com/actions/deploy-pages/actions/workflows/release.yml

View File

@@ -9,6 +9,9 @@ inputs:
description: 'Should this action only emit build telemetry instead of deploying the build artifact?' description: 'Should this action only emit build telemetry instead of deploying the build artifact?'
required: false required: false
default: 'false' default: 'false'
conclusion:
description: 'The status of the previous build.'
required: false
token: token:
description: 'GitHub token' description: 'GitHub token'
default: ${{ github.token }} default: ${{ github.token }}

View File

@@ -1 +0,0 @@
module.exports = {presets: ['@babel/preset-env']}

9
dist/index.js vendored
View File

@@ -8199,8 +8199,6 @@ module.exports = function getContext() {
/***/ 2877: /***/ 2877:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
__nccwpck_require__(4307)
const core = __nccwpck_require__(2186) const core = __nccwpck_require__(2186)
const axios = __nccwpck_require__(6545) const axios = __nccwpck_require__(6545)
@@ -8463,11 +8461,12 @@ async function emitTelemetry() {
// All variables we need from the runtime are set in the Deployment constructor // All variables we need from the runtime are set in the Deployment constructor
const deployment = new Deployment() const deployment = new Deployment()
const telemetryUrl = `${deployment.githubApiUrl}/repos/${deployment.repositoryNwo}/pages/telemetry` const telemetryUrl = `${deployment.githubApiUrl}/repos/${deployment.repositoryNwo}/pages/telemetry`
core.info(`Sending telemetry for run id ${deployment.workflowRun}`) const conclusion = core.getInput('conclusion') || null
core.info(`Sending telemetry for run id ${deployment.workflowRun}: ${conclusion}`)
await axios await axios
.post( .post(
telemetryUrl, telemetryUrl,
{ github_run_id: deployment.workflowRun }, { github_run_id: deployment.workflowRun, conclusion },
{ {
headers: { headers: {
Accept: 'application/vnd.github.v3+json', Accept: 'application/vnd.github.v3+json',
@@ -8661,8 +8660,6 @@ module.exports = require("zlib");
var __webpack_exports__ = {}; var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => { (() => {
__nccwpck_require__(4307)
// This package assumes a site has already been built and the files exist in the current workspace // This package assumes a site has already been built and the files exist in the current workspace
// If there's an artifact named `artifact.tar`, it can upload that to actions on its own, // If there's an artifact named `artifact.tar`, it can upload that to actions on its own,
// without the user having to do the tar process themselves. // without the user having to do the tar process themselves.

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +0,0 @@
module.exports = {
transform: {
'^.+\\.(js|jsx)$': 'babel-jest'
}
}

2704
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,17 +4,11 @@
"description": "Deploy an actions artifact to GitHub Pages", "description": "Deploy an actions artifact to GitHub Pages",
"main": "./dist/index.js", "main": "./dist/index.js",
"dependencies": { "dependencies": {
"@actions/artifact": "^0.5.2",
"@actions/core": "^1.9.1", "@actions/core": "^1.9.1",
"@babel/plugin-transform-runtime": "^7.16.0",
"axios": "^0.24.0", "axios": "^0.24.0",
"regenerator-runtime": "^0.13.9", "axios-retry": "^3.2.4"
"axios-retry": "^3.2.4",
"tar": "^6.1.11"
}, },
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.16.0",
"@github/prettier-config": "0.0.4",
"@vercel/ncc": "^0.31.1", "@vercel/ncc": "^0.31.1",
"eslint": "^8.2.0", "eslint": "^8.2.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
@@ -24,12 +18,13 @@
"prettier": "^2.4.1" "prettier": "^2.4.1"
}, },
"scripts": { "scripts": {
"lint": "eslint src", "all": "npm run format && npm run lint && npm run prepare && npm run test",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "DEBUG=eslint:cli-engine eslint --fix .",
"lint:check": "DEBUG=eslint:cli-engine eslint .",
"prepare": "ncc build src/index.js -o dist --source-map --license licenses.txt && ncc build src/pre.js -o pre --source-map --license licenses.txt", "prepare": "ncc build src/index.js -o dist --source-map --license licenses.txt && ncc build src/pre.js -o pre --source-map --license licenses.txt",
"test": "jest", "test": "jest"
"format": "prettier --write 'src/**/*.js'",
"format:check": "prettier --check 'src/**/*.js'",
"all": "npm run format && npm run lint && npm run prepare && npm run test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -8199,8 +8199,6 @@ module.exports = function getContext() {
/***/ 2877: /***/ 2877:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
__nccwpck_require__(4307)
const core = __nccwpck_require__(2186) const core = __nccwpck_require__(2186)
const axios = __nccwpck_require__(6545) const axios = __nccwpck_require__(6545)
@@ -8463,11 +8461,12 @@ async function emitTelemetry() {
// All variables we need from the runtime are set in the Deployment constructor // All variables we need from the runtime are set in the Deployment constructor
const deployment = new Deployment() const deployment = new Deployment()
const telemetryUrl = `${deployment.githubApiUrl}/repos/${deployment.repositoryNwo}/pages/telemetry` const telemetryUrl = `${deployment.githubApiUrl}/repos/${deployment.repositoryNwo}/pages/telemetry`
core.info(`Sending telemetry for run id ${deployment.workflowRun}`) const conclusion = core.getInput('conclusion') || null
core.info(`Sending telemetry for run id ${deployment.workflowRun}: ${conclusion}`)
await axios await axios
.post( .post(
telemetryUrl, telemetryUrl,
{ github_run_id: deployment.workflowRun }, { github_run_id: deployment.workflowRun, conclusion },
{ {
headers: { headers: {
Accept: 'application/vnd.github.v3+json', Accept: 'application/vnd.github.v3+json',

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,3 @@
require('regenerator-runtime/runtime')
const core = require('@actions/core') const core = require('@actions/core')
const axios = require('axios') const axios = require('axios')

View File

@@ -1,5 +1,3 @@
require('regenerator-runtime/runtime')
// This package assumes a site has already been built and the files exist in the current workspace // This package assumes a site has already been built and the files exist in the current workspace
// If there's an artifact named `artifact.tar`, it can upload that to actions on its own, // If there's an artifact named `artifact.tar`, it can upload that to actions on its own,
// without the user having to do the tar process themselves. // without the user having to do the tar process themselves.

View File

@@ -5,8 +5,6 @@ const path = require('path')
const nock = require('nock') const nock = require('nock')
const axios = require('axios') const axios = require('axios')
const { expect, jest } = require('@jest/globals')
const { Deployment } = require('./deployment') const { Deployment } = require('./deployment')
describe('with all environment variables set', () => { describe('with all environment variables set', () => {

View File

@@ -22,11 +22,12 @@ async function emitTelemetry() {
// All variables we need from the runtime are set in the Deployment constructor // All variables we need from the runtime are set in the Deployment constructor
const deployment = new Deployment() const deployment = new Deployment()
const telemetryUrl = `${deployment.githubApiUrl}/repos/${deployment.repositoryNwo}/pages/telemetry` const telemetryUrl = `${deployment.githubApiUrl}/repos/${deployment.repositoryNwo}/pages/telemetry`
core.info(`Sending telemetry for run id ${deployment.workflowRun}`) const conclusion = core.getInput('conclusion') || null
core.info(`Sending telemetry for run id ${deployment.workflowRun}: ${conclusion}`)
await axios await axios
.post( .post(
telemetryUrl, telemetryUrl,
{ github_run_id: deployment.workflowRun }, { github_run_id: deployment.workflowRun, conclusion },
{ {
headers: { headers: {
Accept: 'application/vnd.github.v3+json', Accept: 'application/vnd.github.v3+json',

View File

@@ -2,8 +2,6 @@ const core = require('@actions/core')
const process = require('process') const process = require('process')
const axios = require('axios') const axios = require('axios')
const { expect, jest } = require('@jest/globals')
const { emitTelemetry } = require('./pre') const { emitTelemetry } = require('./pre')
describe('emitTelemetry', () => { describe('emitTelemetry', () => {
@@ -17,6 +15,7 @@ describe('emitTelemetry', () => {
process.env.GITHUB_ACTOR = 'monalisa' process.env.GITHUB_ACTOR = 'monalisa'
process.env.GITHUB_ACTION = '__monalisa/octocat' process.env.GITHUB_ACTION = '__monalisa/octocat'
process.env.GITHUB_ACTION_PATH = 'something' process.env.GITHUB_ACTION_PATH = 'something'
process.env.INPUT_CONCLUSION = 'success'
jest.spyOn(core, 'setOutput').mockImplementation(param => { jest.spyOn(core, 'setOutput').mockImplementation(param => {
return param return param
@@ -47,7 +46,8 @@ describe('emitTelemetry', () => {
expect(axios.post).toBeCalledWith( expect(axios.post).toBeCalledWith(
'https://api.github.com/repos/actions/is-awesome/pages/telemetry', 'https://api.github.com/repos/actions/is-awesome/pages/telemetry',
{ {
github_run_id: process.env.GITHUB_RUN_ID github_run_id: process.env.GITHUB_RUN_ID,
conclusion: 'success'
}, },
{ {
headers: { headers: {