From 6b87c4d5b0dfd8d0f4f710ffe919f95389bbf014 Mon Sep 17 00:00:00 2001 From: Jeremy Ward Date: Thu, 19 Nov 2020 17:59:44 -0600 Subject: [PATCH] Fix logging --- README.md | 11 +++++++---- action.yml | 3 +++ index.js | 5 ++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b49e5ae..0a0abb3 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # gh-action-autoarchive-stale-cards-for-column This action allows the archiving of stale project cards in a given Github Project column. Helpful especially for cleaning up columns like "Done" -## Use -- Create a .yml workflow in `.github/workflows` directory of the repo that will run the action. -- Follow the below template to use the action and make sure to fill out all required environment variables. - ## Workflow Template ``` name: Archive Stale Done Cards @@ -43,6 +39,13 @@ jobs: # Required: Integer for how many days must have elapsed since the last time this card was touched days-old: 5 ``` +## Required Inputs +- `access-token`: Access token for repository. Use `"{{ secrets.GITHUB_TOKEN }}"` to prevent leaking secrets. This may require setting up a token with increased privileges. The token must have `repo` privileges. +- `repository`: String with target repo name (e.g. 'kin/gh-action-autoarchive-issues-for-column' should be 'gh-action-autoarchive-issues-for-column' here) +- `repository-owner`: String with repo owner name only (e.g. 'kin/gh-action-autoarchive-issues-for-column' should be 'kin' here) +- `project-name`: String with name of project the target column is in (case insensitive) +- `column-to-archive`: String with target column name (case insensitive) +- `days-old`: Integer for how many days must have elapsed since the last time each card was touched before archiving ## Contribution To cotnribute, please open an Issue on the action repo: https://github.com/kin/gh-action-autoarchive-issues-for-column to discuss bugs/modifications. diff --git a/action.yml b/action.yml index 8b68e05..2bed8aa 100644 --- a/action.yml +++ b/action.yml @@ -28,3 +28,6 @@ outputs: runs: using: 'node12' main: 'index.js' +branding: + icon: 'archive' + color: 'yellow' diff --git a/index.js b/index.js index f527ae0..6250d0d 100644 --- a/index.js +++ b/index.js @@ -108,7 +108,8 @@ const run = async () => { .map(node => node.id) // Archive those - https://docs.github.com/en/free-pro-team@latest/rest/reference/projects#update-an-existing-project-card - let archivedCards = 0 + + console.log(`Archiving ${cardIdsToArchive.length} cards`) cardIdsToArchive.forEach(async (id) => { try { @@ -118,7 +119,6 @@ const run = async () => { authorization: `bearer ${accessToken}`, }, }) - archivedCards += 1 } catch(e) { console.log('archiveCard error: ', e) @@ -126,7 +126,6 @@ const run = async () => { } }) - console.log(`Archived ${archivedCards} cards`) } catch (error) { core.setFailed(error.message); }