srggrs / assign-one-project-github-action

Automatically add an issue or pull request to specific GitHub Project(s) when you create and/or label them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MY_GITHUB_TOKEN not defined

smt116 opened this issue · comments

I have a workflow for assigning Dependabot's pull requests to the project. It uses the dependencies label as the condition. The problem is that the action fails with the "MY_GITHUB_TOKEN not defined" message whenever triggered by Dependabot. It succeeds after clicking on the "re-run" button or when triggering it manually by assigning the label to the pull request.

Repositories that use the workflow are organization-based. I created a PAT for myself and then assigned it as the secret to the relevant organization.

# .github/workflows/dependabot-code-review.yml

name: Assign Dependabot Pull Requests

on:
  pull_request:
    types:
      - labeled

env:
  MY_GITHUB_TOKEN: ${{ secrets.DEPENDABOT_GITHUB_TOKEN }}

jobs:
  assign_one_project:
    runs-on: ubuntu-latest
    name: Code Review
    steps:
    - name: Assign Pull Request to the Development Project
      uses: srggrs/assign-one-project-github-action@1.2.1
      if: |
        contains(github.event.pull_request.labels.*.name, 'dependencies')
      with:
        project: 'https://github.com/orgs/[organization name]/projects/1'
        column_name: 'Code review'

Logs

2021-08-02T05:03:02.1716362Z Current runner version: '2.279.0'
2021-08-02T05:03:02.1807448Z ##[group]Operating System
2021-08-02T05:03:02.1808755Z Ubuntu
2021-08-02T05:03:02.1809287Z 20.04.2
2021-08-02T05:03:02.1809775Z LTS
2021-08-02T05:03:02.1810239Z ##[endgroup]
2021-08-02T05:03:02.1811064Z ##[group]Virtual Environment
2021-08-02T05:03:02.1811655Z Environment: ubuntu-20.04
2021-08-02T05:03:02.1812239Z Version: 20210726.1
2021-08-02T05:03:02.1813164Z Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20210726.1/images/linux/Ubuntu2004-README.md
2021-08-02T05:03:02.1814480Z Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20210726.1
2021-08-02T05:03:02.1815373Z ##[endgroup]
2021-08-02T05:03:02.1817367Z ##[group]GITHUB_TOKEN Permissions
2021-08-02T05:03:02.1819026Z Actions: read
2021-08-02T05:03:02.1819583Z Checks: read
2021-08-02T05:03:02.1820159Z Contents: read
2021-08-02T05:03:02.1821010Z Deployments: read
2021-08-02T05:03:02.1821539Z Discussions: read
2021-08-02T05:03:02.1822380Z Issues: read
2021-08-02T05:03:02.1822831Z Metadata: read
2021-08-02T05:03:02.1823356Z Packages: read
2021-08-02T05:03:02.1823849Z PullRequests: read
2021-08-02T05:03:02.1824488Z RepositoryProjects: read
2021-08-02T05:03:02.1825072Z SecurityEvents: read
2021-08-02T05:03:02.1825617Z Statuses: read
2021-08-02T05:03:02.1826246Z ##[endgroup]
2021-08-02T05:03:02.1829870Z Prepare workflow directory
2021-08-02T05:03:02.3206396Z Prepare all required actions
2021-08-02T05:03:02.3218480Z Getting action download info
2021-08-02T05:03:02.7623016Z Download action repository 'srggrs/assign-one-project-github-action@1.2.1'
2021-08-02T05:03:04.9221914Z ##[group]Build container for action use: '/home/runner/work/_actions/srggrs/assign-one-project-github-action/1.2.1/Dockerfile'.
2021-08-02T05:03:04.9276716Z ##[command]/usr/bin/docker build -t [...]:[...] -f "/home/runner/work/_actions/srggrs/assign-one-project-github-action/1.2.1/Dockerfile" "/home/runner/work/_actions/srggrs/assign-one-project-github-action/1.2.1"
2021-08-02T05:03:07.0661159Z Sending build context to Docker daemon   25.6kB
2021-08-02T05:03:07.0663757Z
2021-08-02T05:03:07.1141416Z Step 1/4 : FROM alpine:3.10
2021-08-02T05:03:08.0202426Z 3.10: Pulling from library/alpine
2021-08-02T05:03:08.2474498Z 396c31837116: Pulling fs layer
2021-08-02T05:03:08.6238288Z 396c31837116: Verifying Checksum
2021-08-02T05:03:08.6244749Z 396c31837116: Download complete
2021-08-02T05:03:08.7793485Z 396c31837116: Pull complete
2021-08-02T05:03:08.7900826Z Digest: sha256:[...]
2021-08-02T05:03:08.7936806Z Status: Downloaded newer image for alpine:3.10
2021-08-02T05:03:08.7953241Z  ---> [...]
2021-08-02T05:03:08.7962602Z Step 2/4 : RUN apk add --no-cache --no-progress curl jq
2021-08-02T05:03:08.8611341Z  ---> Running in [...]
2021-08-02T05:03:09.7607899Z fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
2021-08-02T05:03:09.9044480Z fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
2021-08-02T05:03:10.0136266Z (1/6) Installing ca-certificates (20191127-r2)
2021-08-02T05:03:10.0438135Z (2/6) Installing nghttp2-libs (1.39.2-r1)
2021-08-02T05:03:10.0609326Z (3/6) Installing libcurl (7.66.0-r4)
2021-08-02T05:03:10.0821660Z (4/6) Installing curl (7.66.0-r4)
2021-08-02T05:03:10.1022218Z (5/6) Installing oniguruma (6.9.4-r1)
2021-08-02T05:03:10.1211796Z (6/6) Installing jq (1.6-r0)
2021-08-02T05:03:10.1434440Z Executing busybox-1.30.1-r5.trigger
2021-08-02T05:03:10.1474869Z Executing ca-certificates-20191127-r2.trigger
2021-08-02T05:03:10.1830888Z OK: 8 MiB in 20 packages
2021-08-02T05:03:11.0254319Z Removing intermediate container [...]
2021-08-02T05:03:11.0258669Z  ---> f4a5a5db36f9
2021-08-02T05:03:11.0259916Z Step 3/4 : COPY entrypoint.sh /entrypoint.sh
2021-08-02T05:03:12.0205121Z  ---> 4915e9b0ffaa
2021-08-02T05:03:12.0205977Z Step 4/4 : ENTRYPOINT ["/entrypoint.sh"]
2021-08-02T05:03:12.0373517Z  ---> Running in [...]
2021-08-02T05:03:13.0113439Z Removing intermediate container [...]
2021-08-02T05:03:13.0115472Z  ---> e9a6e3a64053
2021-08-02T05:03:13.0121748Z Successfully built [...]
2021-08-02T05:03:13.0177656Z Successfully tagged [...]:[...]
2021-08-02T05:03:13.0216868Z ##[endgroup]
2021-08-02T05:03:13.0571874Z ##[group]Run srggrs/assign-one-project-github-action@1.2.1
2021-08-02T05:03:13.0572901Z with:
2021-08-02T05:03:13.0573599Z   project: https://github.com/orgs/[...]/projects/1
2021-08-02T05:03:13.0574332Z   column_name: Code review
2021-08-02T05:03:13.0574718Z env:
2021-08-02T05:03:13.0575084Z   MY_GITHUB_TOKEN:
2021-08-02T05:03:13.0575469Z ##[endgroup]
2021-08-02T05:03:13.0644356Z ##[command]/usr/bin/docker run --name [...] --label [...] --workdir /github/workspace --rm -e MY_GITHUB_TOKEN -e INPUT_PROJECT -e INPUT_COLUMN_NAME -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/[...]/[...]":"/github/workspace" [...]:[...]  "https://github.com/orgs/[...]/projects/1" "Code review"
2021-08-02T05:03:13.4165833Z MY_GITHUB_TOKEN not defined
2021-08-02T05:03:13.5731721Z Cleaning up orphan processes
commented

mmm very strange.... seems there is no definition of the MY_GITHUB_TOKEN in the first run

Is it possible that this is because the secret has a different name (i.e. MY_GITHUB_TOKEN: ${{ secrets.DEPENDABOT_GITHUB_TOKEN }})? Do you have any hints for debugging this issue?

Same problem here. Don't think it's because of a different name because I've named it MY_GITHUB_TOKEN.