GitHub Actions – “Node.js 12 actions are deprecated.” 尽管我已将所有内容升级到v18。

huangapple go评论156阅读模式
英文:

GitHub Actions - "Node.js 12 actions are deprecated." although I upgraded everything to v18

问题

我收到了警告

Node.js 12 操作已被弃用。
有关更多信息,请参见:https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/。
请更新以下操作以使用 Node.js 16:./

我知道这是因为 v12 已被弃用并且将被移除,但我已将我的用法从 v12 更改为 v18,但我不明白为什么我仍然收到此警告。它应该已经消失了。

我已阅读了有关 GitHub Actions 维护者的文档:https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions

  • 我只在那里指定了一个 Node.js 版本:https://github.com/UnlyEd/github-action-await-vercel/blob/main/.github/workflows/update-codeclimate-coverage.yml#L24
  • 我使用了 "@actions/core": "1.10.0"

GitHub Actions – “Node.js 12 actions are deprecated.” 尽管我已将所有内容升级到v18。

英文:

I get the warning

Node.js 12 actions are deprecated. 
For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. 
Please update the following actions to use Node.js 16: ./

I know it's because v12 has been deprecated and is being removed, but I've changed my usages from v12 to v18 and I don't understand why I still get this warning. It should have vanished.

I've read the doc for Actions Maintainers at https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions

GitHub Actions – “Node.js 12 actions are deprecated.” 尽管我已将所有内容升级到v18。

答案1

得分: 5

我在使用GitHub actions部署NextJS应用程序时遇到了这个问题。

我的作业看起来像这样:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

问题出在actions/checkout@v2上,它已被弃用。我只需要升级到actions/checkout@v3。所以我的作业看起来像这样:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

资源: 示例:使用版本化的操作

英文:

I faced this issue when deploying a NextJS application using GitHub actions.

My job looked like this:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

The issue was with the actions/checkout@v2 which had be deprecated. All I had to do was to upgrade to actions/checkout@v3. So my job looked like this next:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

Resources: Example: Using versioned actions

答案2

得分: 2

在编写问题时,我注意到在 https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions 中有一个 runs:。我曾看到它,但忽略了它。

我没有理解它位于根目录的 /action.yml 中。

这是一个示例:https://github.com/UnlyEd/github-action-await-vercel/blob/cee5b33a0725899c2a78be7d73819114f6aac745/action.yml#L17

显然,更改这一行修复了问题。

英文:

While writing the question, I noticed in https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions that there was a runs:. I had seen it, and overlooked it.

I didn't understood it was located in the /action.yml, at the root.

Here is an example: https://github.com/UnlyEd/github-action-await-vercel/blob/cee5b33a0725899c2a78be7d73819114f6aac745/action.yml#L17

Changing this line obviously fixed the issue.

答案3

得分: 2

我在我的Next.js项目中遇到了相同的问题。

我可以通过在GitHub workflow/*.yml文件中将node-version设置为16来解决这个问题。
例如:

jobs:
  build:
    name: Production
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          node-version: 16
英文:

I faced the same issue in my Next.js project.

I could resolve this issue by setting node-version as 16 in the GitHub workflow/*.yml file.
For example:

jobs:
  bulid:
    name: Production
    # 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

      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          node-version: 16

huangapple
  • 本文由 发表于 2023年1月10日 03:01:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75061837.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定