未捕获引用错误:进程未定义Github个人访问令牌问题
我想将我的github个人访问令牌(用于验证github graphql api)添加到我的代码中,但github会在部署后立即将其从开发人员设置中删除。我尝试将其添加为环境变量,方法是将其添加到secrets中,并在github actions CI脚本中的未捕获引用错误:进程未定义Github个人访问令牌问题,github,continuous-integration,github-pages,github-api,github-actions,Github,Continuous Integration,Github Pages,Github Api,Github Actions,我想将我的github个人访问令牌(用于验证github graphql api)添加到我的代码中,但github会在部署后立即将其从开发人员设置中删除。我尝试将其添加为环境变量,方法是将其添加到secrets中,并在github actions CI脚本中的env:下声明,然后在代码中使用process.env.PA_TOKEN调用它,但它仍然无法进行身份验证,尽管我在控制台中收到了另一条错误消息,即uncaughtreferenceerror:未定义流程。我做错了什么 注意:在部署后从开发人
env:
下声明,然后在代码中使用process.env.PA_TOKEN
调用它,但它仍然无法进行身份验证,尽管我在控制台中收到了另一条错误消息,即uncaughtreferenceerror:未定义流程
。我做错了什么
注意:在部署后从开发人员设置中删除令牌之前,令牌在本地工作正常
Github操作工作流
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
代码实现
const variables = {
githubToken: process.env.PERSONAL_ACCESS_TOKEN,
githubLogin: username
}
能否共享您的github操作工作流和代码实现?@GuiFalourd在EditsID中添加了它们您是否尝试将操作添加到工作流以测试错误是否相同?否则,这可能也会有所帮助。