我使用这个GitHub操作https://github.com/JamesIves/fetch-api-data-action来获取和保存由API获取的数据:
这是我对两个操作的配置,一个操作获取API,然后构建和部署以保存从API获取的.json。
name: Refresh Feed
on: [push]
jobs:
refresh-feed:
runs-on: ubuntu-latest
steps:
- name: Fetch API Data
uses: JamesIves/fetch-api-data-action@releases/v1
with:
ENDPOINT: https://data
BRANCH: master # Pushes the updates to the master branch.
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@4.1.1
with:
branch: master # The branch the action should deploy to.
folder: . # The folder the action should deploy.如果出现此错误,则失败
Run JamesIves/github-pages-deploy-action@4.1.1
9
10
GitHub Pages Deploy Action
11
12
Getting Started Guide: https://github.com/marketplace/actions/deploy-to-github-pages
13
❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
14
Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
15
16
Maintained by James Ives: https://jamesiv.es
17
Support: https://github.com/sponsors/JamesIves
18
Checking configuration and starting deployment…
19
Deploying using Deploy Token…
20
Configuring git…
21
/usr/bin/git config user.name abcname
22
fatal: not in a git directory
23
Error: There was an error initializing the repository: The process '/usr/bin/git' failed with exit code 128 ❌
24
Deployment failed! ❌我也尝试了“公共”作为文件夹,但它也失败了,因为它说它不存在(我的回购确实有那个文件夹)
发布于 2021-05-07 19:50:24
您正在使用该操作的旧版本。也许尝试转到v4,它以不同的方式处理这些参数。如果要回推到同一个存储库,甚至不需要传递令牌。
除此之外,我认为还有两件事需要检查:
main,而在第二个操作中引用master。它们指向同一个存储库吗?如果是这样的话,我认为分支的名称将是相同的。ACCESS_TOKEN的文档意味着您需要使用存储在机密中的生成的个人访问令牌。这就是我在使用此操作时所使用的操作,尽管我正在将其推送到不同的存储库,因此无论如何都是必须的。不过,我很久以前就搬到v4了。
https://stackoverflow.com/questions/67440780
复制相似问题