Skip to content

Commit

Permalink
2.0.0 release (#8)
Browse files Browse the repository at this point in the history
* Upgrading action to JS Action

* Swapping to double-quotes for strings

* Switching parcel bundle to target node

* Updating docs
  • Loading branch information
lannonbr authored Aug 26, 2019
1 parent ec12660 commit 56bf520
Show file tree
Hide file tree
Showing 11 changed files with 7,860 additions and 277 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
.cache
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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);
Expand All @@ -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;
Expand Down
204 changes: 204 additions & 0 deletions lib/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 56bf520

Please sign in to comment.