build: inline external Github Actions to unblock CI (#12241)

* build: inline cached-dependencies to unblock CI

* Run E2E on pull_request on;y

* Inline all external actions

* Checkout needed for internal actions

Also fixes pre-commit

* Add missing files
This commit is contained in:
Jesse Yang
2021-01-04 04:16:07 -08:00
committed by GitHub
parent 7cc0de1694
commit a3bbbf8ea3
173 changed files with 48871 additions and 78 deletions

View File

@@ -0,0 +1,53 @@
{
"projectName": "latest-tag",
"projectOwner": "EndBug",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"commitConvention": "angular",
"contributors": [
{
"login": "EndBug",
"name": "Federico Grandi",
"avatar_url": "https://avatars1.githubusercontent.com/u/26386270?v=4",
"profile": "https://github.com/EndBug",
"contributions": [
"code",
"doc"
]
},
{
"login": "kslr",
"name": "Kslr",
"avatar_url": "https://avatars3.githubusercontent.com/u/5516323?v=4",
"profile": "https://github.com/kslr",
"contributions": [
"code"
]
},
{
"login": "DocX",
"name": "Lukáš Doležal",
"avatar_url": "https://avatars0.githubusercontent.com/u/132277?v=4",
"profile": "http://lukas.dolezalu.cz/",
"contributions": [
"code"
]
},
{
"login": "ziyangczi",
"name": "ziyangczi",
"avatar_url": "https://avatars0.githubusercontent.com/u/41968256?v=4",
"profile": "https://github.com/ziyangczi",
"contributions": [
"ideas"
]
}
],
"contributorsPerLine": 7,
"skipCi": true
}

38
.github/actions/latest-tag/.eslintrc.js vendored Normal file
View File

@@ -0,0 +1,38 @@
module.exports = {
env: {
commonjs: true,
es6: true,
node: true
},
extends: [
'eslint:recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended'
],
globals: {},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {
'prettier/prettier': 'warn',
'no-cond-assign': [2, 'except-parens'],
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 1,
'no-empty': [
'error',
{
allowEmptyCatch: true
}
],
'prefer-const': [
'warn',
{
destructuring: 'all'
}
],
'spaced-comment': 'warn'
}
}

View File

@@ -0,0 +1,80 @@
# General purpose
- name: 'good first issue'
color: '5319e7'
description: 'Good for newcomers'
aliases: []
- name: 'help wanted'
color: '008672'
description: 'Extra attention is needed'
aliases: []
- name: 'status: pending'
color: c5def5
description: 'More info is needed before deciding what to do.'
aliases: []
- name: 'status: pinned'
color: 0052cc
description: 'Issues and PRs that should not be labeled as stale or closed if they remain inactive.'
aliases: []
- name: 'status: stale'
color: fbca04
description: 'Inactive issues and PRs.'
aliases: ['stale']
- name: 'status: wontfix'
color: ffffff
description: 'This will not be worked on.'
aliases: ['wontfix']
- name: 'type: automation'
color: 2fc904
description: 'About actions workflows and automation.'
aliases: ['automation', 'actions']
- name: 'type: bug'
color: d73a4a
description: 'Verified problems that need to be worked on.'
aliases: ['bug']
- name: 'type: dependencies'
color: 0366d6
description: 'Pull requests that update a dependency file'
aliases: ['dependencies']
- name: 'type: duplicate'
color: cfd3d7
description: 'This issue or pull request already exists.'
aliases: ['duplicate']
- name: 'type: enhancement'
color: a2eeef
description: 'New feature or request.'
aliases: ['enhancement']
- name: 'type: invalid'
color: e4e669
description: "This doesn't seem right."
aliases: ['invalid']
- name: 'type: maintenance'
color: 0075ca
description: "Documentation improvements and code refactoring, doesn't affect functionality."
aliases: ['documentation', 'docs']
- name: 'type: not a bug'
color: 0e8a16
description: 'Reports that happen not be our fault.'
aliases: ['not a bug']
- name: 'type: question'
color: d876e3
description: 'Further information is requested.'
aliases: ['question']
- name: 'type: security'
color: 'ee0701'
description: 'Pull requests that address a security vulnerability.'
aliases: ['security']

View File

@@ -0,0 +1,25 @@
name: Build action
on:
push:
paths:
- src/**
- package.json
- package-lock.json
- .github/workflows/build.yml
jobs:
build:
name: Build with @zeit/ncc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm run build
- uses: EndBug/add-and-commit@v4
with:
add: lib
force: true
message: "[auto] Update build"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,19 @@
name: Sync labels
on:
push:
branches:
- master
paths:
- '.github/labels.yml'
workflow_dispatch:
jobs:
sync:
name: Run EndBug/label-sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: EndBug/label-sync@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: '.github/labels.yml'

View File

@@ -0,0 +1,19 @@
name: Add latest tag to new release
on:
release:
types: [published]
jobs:
run:
name: Run local action
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Run latest-tag
uses: EndBug/latest-tag@v1
with:
description: This tag has been auto-generated by this action.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,16 @@
# This workflow uses the Actions Tagger action, which is a viable alternative to Latest Tag.
# If you want to see an example on how to use Latest Tag, please check out the latest-tag.yml file in this directory.
name: Keep the major versions up-to-date
on:
release:
types: [published]
jobs:
actions-tagger:
runs-on: ubuntu-latest
steps:
- uses: Actions-R-Us/actions-tagger@v1
env:
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"

View File

@@ -0,0 +1,19 @@
name: Test
on: [push, pull_request, workflow_dispatch]
jobs:
build:
name: Test build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm run build
lint:
name: Check linting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm run lint

1
.github/actions/latest-tag/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

View File

@@ -0,0 +1,7 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "none"
}

21
.github/actions/latest-tag/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Federico Grandi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

57
.github/actions/latest-tag/README.md vendored Normal file
View File

@@ -0,0 +1,57 @@
# Latest tag
[![All Contributors](https://img.shields.io/github/all-contributors/EndBug/latest-tag)](#contributors-)
Automatically creates & updates a `latest` tag pointing to your latest release.
When using GitHub Actions you always have to put a reference for every action you use in your worflows: that means that you either need to choose a specific version or you need to use a branch.
If you want to use the **latest** release of an action you can only hope authors are mantaining a `latest` tag that they update with every version: although not impossible, it's not that easy to find someone willing to do that.
That's why I made this action: if you're the kind of guy that doesn't like to update tags you can simply use this action and forget about it. You can just put `latest` in the documentation: your users will get the benefits of using a branch as ref and the security of using only stable versions (as long as you don't make breaking changes).
## Usage
Add a step like this to your workflow:
```yaml
- name: Run latest-tag
uses: EndBug/latest-tag@latest
with:
# You can change the name of the tag with this input.
# Default: 'latest'
tag-name: someCustomTagName
# If a description is provided, the action will use it to create an annotated tag. If none is given, the action will create a lightweight tag.
# Optional
description: Description for the tag
```
## License
This action is distributed under the MIT license, check the [license](LICENSE) for more info.
## Similar actions
[actions-tagger](https://github.com/marketplace/actions/actions-tagger): allows you to create and update both `latest` and major version tags, even though it doesn't support annotated tags and the major version tag is mandatory (ref v2.0.1).
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/EndBug"><img src="https://avatars1.githubusercontent.com/u/26386270?v=4" width="100px;" alt=""/><br /><sub><b>Federico Grandi</b></sub></a><br /><a href="https://github.com/EndBug/latest-tag/commits?author=EndBug" title="Code">💻</a> <a href="https://github.com/EndBug/latest-tag/commits?author=EndBug" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/kslr"><img src="https://avatars3.githubusercontent.com/u/5516323?v=4" width="100px;" alt=""/><br /><sub><b>Kslr</b></sub></a><br /><a href="https://github.com/EndBug/latest-tag/commits?author=kslr" title="Code">💻</a></td>
<td align="center"><a href="http://lukas.dolezalu.cz/"><img src="https://avatars0.githubusercontent.com/u/132277?v=4" width="100px;" alt=""/><br /><sub><b>Lukáš Doležal</b></sub></a><br /><a href="https://github.com/EndBug/latest-tag/commits?author=DocX" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/ziyangczi"><img src="https://avatars0.githubusercontent.com/u/41968256?v=4" width="100px;" alt=""/><br /><sub><b>ziyangczi</b></sub></a><br /><a href="#ideas-ziyangczi" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
</table>
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

19
.github/actions/latest-tag/action.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: 'Latest tag'
description: Automatically generate & update a 'latest' tag for your releases
inputs:
description:
description: 'Tag description'
required: false
tag-name:
description: 'Tag name'
required: false
default: latest
runs:
using: 'node12'
main: 'lib/index.js'
branding:
icon: tag
color: blue

File diff suppressed because one or more lines are too long

1796
.github/actions/latest-tag/package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

43
.github/actions/latest-tag/package.json vendored Normal file
View File

@@ -0,0 +1,43 @@
{
"name": "latest-tag",
"version": "1.4.0",
"description": "Automatically generate & update a 'latest' tag for your releases",
"main": "lib/index.js",
"scripts": {
"build": "ncc build src/action.ts --minify --out lib",
"lint": "eslint --ext .ts src",
"lint:fix": "eslint --ext .ts src --fix",
"test": "echo \"Error: no test specified\" && exit 1"
},
"husky": {
"hooks": {
"pre-commit": "npm run build && npm run lint && git add lib"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/EndBug/latest-tag.git"
},
"author": "Federico Grandi <fgrandi30@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/EndBug/latest-tag/issues"
},
"homepage": "https://github.com/EndBug/latest-tag#readme",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/github": "^2.1.1"
},
"devDependencies": {
"@types/node": "^13.9.0",
"@typescript-eslint/eslint-plugin": "^4.11.0",
"@typescript-eslint/parser": "^4.11.0",
"@zeit/ncc": "^0.21.1",
"eslint": "^7.16.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.3.0",
"husky": "^4.3.6",
"prettier": "^2.2.1",
"typescript": "^3.8.3"
}
}

View File

@@ -0,0 +1,45 @@
import { setFailed, getInput, info } from '@actions/core'
import * as util from 'util'
import * as child_process from 'child_process'
const { GITHUB_ACTOR } = process.env
async function exec(command: string) {
const { stdout, stderr } = await util.promisify(child_process.exec)(command)
if (stderr) console.error(stderr)
return stdout
}
function annotatedTag(message: string, tagName: string) {
info('Creating annotated tag...')
return exec(`git tag -a -f -m "${message}" ${tagName}`)
}
function lightweightTag(tagName: string) {
info('Creating lightweight tag...')
return exec(`git tag -f ${tagName}`)
}
async function run() {
try {
info('Setting up git user...')
await exec(`git config user.name "${GITHUB_ACTOR}"`)
await exec(
`git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"`
)
const message = getInput('description')
const tagName = getInput('tag-name')
info(`Using '${tagName}' as tag name.`)
if (message) await annotatedTag(message, tagName)
else await lightweightTag(tagName)
info('Pushing updated tag to repo...')
return await exec(`git push --force origin ${tagName}`)
} catch (error) {
setFailed(error instanceof Error ? error.message : error)
}
}
run()

View File

@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "lib",
"alwaysStrict": true,
"moduleResolution": "node",
"noImplicitAny": false,
"esModuleInterop": true,
"noUnusedLocals": true
},
"include": [
"src/*.ts",
"typings/*"
],
"typeAcquisition": {
"enable": true
},
"compileOnSave": true
}