Skip to content

Commit

Permalink
add gh token mandatory field
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol-Baranwal committed Nov 11, 2023
1 parent c615567 commit db6ed60
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v2
- uses: ./
with:
node-version: 16
gh-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Setup Node.js
# uses: actions/setup-node@v2
# with:
# node-version: 16

- name: Install Dependencies
run: npm install
# - name: Install Dependencies
# run: npm install

- name: Compile TypeScript
run: npx tsc
# - name: Compile TypeScript
# run: npx tsc

- name: Run Custom Action
run: |
node dist/index.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Run Custom Action
# run: |
# node dist/index.js
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ inputs:
default: ""
close:
description: "Close the current issue if set to true."
gh-token:
description: "The GitHub token for authentication."
required: true
runs:
using: "node16"
main: "dist/index.js"
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ async function HandleMultipleIssues() {
var _a;
console.log("Hello World!");
try {
const token = process.env.GITHUB_TOKEN;
// const token = process.env.GITHUB_TOKEN;
const token = core.getInput("gh-token");
if (!token)
core.debug(token + "");
else
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ async function HandleMultipleIssues() {
console.log("Hello World!");

try {
const token = process.env.GITHUB_TOKEN;
// const token = process.env.GITHUB_TOKEN;
const token = core.getInput("gh-token");

if (!token) core.debug(token + "");
else core.debug(token);
Expand Down

0 comments on commit db6ed60

Please sign in to comment.