seferov/pr-lint-action

Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.GITHUB_TOKEN

pqt opened this issue ยท 6 comments

pqt commented

For some reason (might totally be me) I cannot get this workflow to run, it fails in setup

I can use other workflows fine that do similar things, but this action is the one I'd prefer to use. I tried the manual approach and the GitHub workflow helper UI. Both failed in similar fashion.

I also tried to add the following configuration but it failed in the same way.

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

References:

Since I'm deleting and testing on a throwaway repo, here's the exact configuration of my workflow for that given failure (with the env included, though the results are the same without)

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  pull_request:
    types: ["opened", "edited", "reopened", "synchronize"]
  # push:
  #   branches: [ master ]
  # pull_request:
  #   branches: [ master ]

# 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.

      # Runs a PR Linting Action
      - name: PR Lint GitHub Action
        uses: seferov/pr-lint-action@v1.1.0
        with:
          # Title regex to match
          title-regex: ^\[PROJECT-\d{3,}\] \ # default is ^\[PROJECT-\d*\]\
          # ${{ secrets.GITHUB_TOKEN }}
          # github-token: # optional
          # If set, on a failing job automatically closes pull request and comments on it with the given value
          # auto-close-message: # optional
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

thank you for the report.

I think the problem is with the regex. It should be enclosed with quotes.

- name: PR Lint GitHub Action
  uses: seferov/pr-lint-action@v1.1.0
  with:
    title-regex: '^\[PROJECT-\d{3,}\](\ )'
    github-token: ${{ secrets.GITHUB_TOKEN }}
pqt commented

๐Ÿ™„ I had a feeling I was missing something...

Going to take a look at this shortly and check back.

pqt commented

@seferov I wrapped it in quotes but it did not change the error message. It still fails to run.

@pqt yes, the problem was with the version (v1.1.0). Please use v1.1.1. Here is the demo #72

pqt commented

Just tested it an can confirm it works as expected now!

๐ŸŽ‰ Nicely done.

thank you for the report.