2.0.0 release (#8)
* Upgrading action to JS Action * Swapping to double-quotes for strings * Switching parcel bundle to target node * Updating docs
This commit is contained in:
parent
ec1266042a
commit
56bf52020f
11 changed files with 7752 additions and 169 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
node_modules
|
||||
.cache
|
11
CHANGELOG.md
Normal file
11
CHANGELOG.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# 2.0.0 - August 25, 2019
|
||||
|
||||
- feat: Updated to JS Actions syntax. Removed Dockerfile and switched to action.yml with bundled version of package using parcel
|
||||
|
||||
# 1.1.0 - February 19, 2019
|
||||
|
||||
- feat: When inserting a color in a hexcode syntax, having a # in front of it will work as expected
|
||||
|
||||
# 1.0.0 - February 11, 2019
|
||||
|
||||
Initial Release
|
19
Dockerfile
19
Dockerfile
|
@ -1,19 +0,0 @@
|
|||
from node:10.14.2-slim
|
||||
|
||||
LABEL version="1.1.0"
|
||||
LABEL repository="https://github/lannonbr/issue-label-manager-action"
|
||||
LABEL maintainer="Benjamin Lannon <benjamin@lannonbr.com>"
|
||||
|
||||
LABEL com.github.actions.name="Issue Label Manager Action"
|
||||
LABEL com.github.actions.description="Will update repo's labels based on data in JSON file located at $REPO/.github/labels.json"
|
||||
LABEL com.github.actions.icon="upload"
|
||||
LABEL com.github.actions.color="green"
|
||||
|
||||
ADD package.json /package.json
|
||||
ADD package-lock.json /package-lock.json
|
||||
WORKDIR /
|
||||
COPY . /
|
||||
|
||||
RUN npm i
|
||||
|
||||
ENTRYPOINT ["node", "/index.js"]
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright 2018 Benjamin Lannnon
|
||||
Copyright 2018-2019 Benjamin Lannnon
|
||||
|
||||
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
|
||||
|
|
11
README.md
11
README.md
|
@ -18,9 +18,10 @@ If a label doesn't need a description, leave out the `description` field of the
|
|||
|
||||
This action only needs the GITHUB_TOKEN secret as it interacts with the GitHub API to modify labels. The action can be used as such:
|
||||
|
||||
```hcl
|
||||
action "Update Label" {
|
||||
uses = "lannonbr/issue-label-manager-action@master"
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
}
|
||||
```yaml
|
||||
steps:
|
||||
- name: "Check & Modify Labels"
|
||||
uses: lannonbr/issue-label-manager-action@2.0.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
|
9
action.yml
Normal file
9
action.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
name: "Issue Label Manager Action"
|
||||
description: "Will update repo's labels based on data in JSON file located at $REPO/.github/labels.json"
|
||||
author: "Benjamin Lannon <benjamin@lannonbr.com>"
|
||||
runs:
|
||||
using: "node12"
|
||||
main: "lib/index.js"
|
||||
branding:
|
||||
icon: "upload"
|
||||
color: "green"
|
35
index.js
35
index.js
|
@ -1,8 +1,9 @@
|
|||
const { Toolkit } = require("actions-toolkit");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const tools = new Toolkit();
|
||||
const octokit = tools.createOctokit();
|
||||
const github = require("@actions/github");
|
||||
|
||||
const accessToken = process.env.GITHUB_TOKEN;
|
||||
const octokit = new github.GitHub(accessToken);
|
||||
|
||||
async function run() {
|
||||
let newLabelsUrl = path.join(
|
||||
|
@ -25,29 +26,32 @@ async function run() {
|
|||
|
||||
labelModList.forEach(async mod => {
|
||||
if (mod.type === "create") {
|
||||
let params = tools.context.repo({
|
||||
let params = {
|
||||
...github.context.repo,
|
||||
name: mod.label.name,
|
||||
color: mod.label.color,
|
||||
description: mod.label.description,
|
||||
headers: { accept: "application/vnd.github.symmetra-preview+json" }
|
||||
});
|
||||
previews: ["symmetra"]
|
||||
};
|
||||
console.log(`[Action] Creating Label: ${mod.label.name}`);
|
||||
|
||||
await octokit.issues.createLabel(params);
|
||||
} else if (mod.type === "update") {
|
||||
let params = tools.context.repo({
|
||||
let params = {
|
||||
...github.context.repo,
|
||||
current_name: mod.label.name,
|
||||
color: mod.label.color,
|
||||
description: mod.label.description,
|
||||
headers: { accept: "application/vnd.github.symmetra-preview+json" }
|
||||
});
|
||||
previews: ["symmetra"]
|
||||
};
|
||||
console.log(`[Action] Updating Label: ${mod.label.name}`);
|
||||
|
||||
await octokit.issues.updateLabel(params);
|
||||
} else if (mod.type === "delete") {
|
||||
let params = tools.context.repo({
|
||||
let params = {
|
||||
...github.context.repo,
|
||||
name: mod.label.name
|
||||
});
|
||||
};
|
||||
console.log(`[Action] Deleting Label: ${mod.label.name}`);
|
||||
|
||||
await octokit.issues.deleteLabel(params);
|
||||
|
@ -56,11 +60,10 @@ async function run() {
|
|||
}
|
||||
|
||||
async function getCurrentLabels() {
|
||||
let response = await octokit.issues.listLabelsForRepo(
|
||||
tools.context.repo({
|
||||
headers: { accept: "application/vnd.github.symmetra-preview+json" }
|
||||
})
|
||||
);
|
||||
let response = await octokit.issues.listLabelsForRepo({
|
||||
...github.context.repo,
|
||||
previews: ["symmetra"]
|
||||
});
|
||||
let data = response.data;
|
||||
|
||||
return data;
|
||||
|
|
204
lib/index.js
Normal file
204
lib/index.js
Normal file
File diff suppressed because one or more lines are too long
1
lib/index.js.map
Normal file
1
lib/index.js.map
Normal file
File diff suppressed because one or more lines are too long
7615
package-lock.json
generated
7615
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -1,13 +1,18 @@
|
|||
{
|
||||
"name": "issue-label-manager-action",
|
||||
"version": "1.1.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Will update repo's labels based on data in JSON file located at $REPO/.github/labels.json",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"keywords": [],
|
||||
"author": "Benjamin Lannon <benjamin@lannonbr.com>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "parcel build index.js --out-dir lib --target node --bundle-node-modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"actions-toolkit": "0.0.4"
|
||||
"@actions/github": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"parcel-bundler": "1.12.3"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue