Skip to content
This repository was archived by the owner on Apr 14, 2023. It is now read-only.

Commit a4b222d

Browse files
committed
fix: add token as npx argument
BREAKING CHANGE: token is second argument and folder moved to third argument
1 parent e8a9afe commit a4b222d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,14 @@ jobs:
2323
- name: Build Action
2424
if: matrix.source == 'action'
2525
run: npm run build
26-
- name: Install Atom with Action
27-
if: matrix.source == 'action' && matrix.version == 'stable'
28-
uses: ./
2926
- name: Install Atom ${{ matrix.version }} with Action
30-
if: matrix.source == 'action' && matrix.version != 'stable'
27+
if: matrix.source == 'action'
3128
uses: ./
3229
with:
3330
version: ${{ matrix.version }}
34-
- name: Install Atom with NPM
35-
if: matrix.source == 'npm' && matrix.version == 'stable'
36-
run: node ./src/action.js
3731
- name: Install Atom ${{ matrix.version }} with NPM
38-
if: matrix.source == 'npm' && matrix.version != 'stable'
39-
run: node ./src/action.js ${{ matrix.version }}
32+
if: matrix.source == 'npm'
33+
run: node ./src/action.js ${{ matrix.version }} ${{ secrets.GITHUB_TOKEN }}
4034
- name: Don't download to repo directory
4135
run: git add . -N && git diff --name-only --exit-code -- . ':!dist'
4236
- name: Run Specs

src/action.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ async function run() {
2222
core.error("'channel' is deprecated. Please use 'version' instead.");
2323
}
2424
const version = channel || (process.env.GITHUB_ACTIONS && core.getInput("version").toLowerCase()) || process.argv[2] || "stable";
25-
const folder = path.resolve(process.env.RUNNER_TEMP, process.argv[3] || "./atom");
26-
const token = (process.env.GITHUB_ACTIONS && core.getInput("token")) || process.argv[4] || "";
25+
const token = (process.env.GITHUB_ACTIONS && core.getInput("token")) || process.argv[3] || "";
26+
const folder = path.resolve(process.env.RUNNER_TEMP, process.argv[4] || "./atom");
2727
core.info(`version: ${version}`);
2828
core.info(`folder: ${folder}`);
2929

src/setup-atom.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ const writeFileAsync = promisify(fs.writeFile);
2121
const CHANNELS = [
2222
"stable",
2323
"beta",
24+
];
25+
26+
const INVALID_CHANNELS = [
2427
"nightly",
2528
"dev",
2629
];
@@ -138,6 +141,9 @@ async function printVersions() {
138141
}
139142

140143
async function findUrl(version, token) {
144+
if (INVALID_CHANNELS.includes(version)) {
145+
throw new Error(`'${version}' is not a valid version.`);
146+
}
141147
if (CHANNELS.includes(version)) {
142148
const octokit = new Octokit({auth: token});
143149
const {data: releases} = await octokit.rest.repos.listReleases({

0 commit comments

Comments
 (0)