Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving cards in organization project does not work #27

Open
hampuslidin opened this issue Apr 5, 2021 · 4 comments · May be fixed by #28
Open

Moving cards in organization project does not work #27

hampuslidin opened this issue Apr 5, 2021 · 4 comments · May be fixed by #28

Comments

@hampuslidin
Copy link

hampuslidin commented Apr 5, 2021

I am facing this issue when trying to move a card from one column to another in an organization project. This worked fine in a repository project. The error message I am seeing is the following:

/usr/bin/docker run --name takanabegithubactionsautomateprojectssha2564e7a164fca9c2a8816e044f405b01215685f8e17e822f21507cfc66939b422cb_1b27a8 --label 5588e4 --workdir /github/workspace --rm -e GITHUB_TOKEN -e GITHUB_PROJECT_URL -e GITHUB_PROJECT_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/[redacted]/[redacted]":"/github/workspace" takanabe/github-actions-automate-projects@sha256:4e7a164fca9c2a8816e044f405b01215685f8e17e822f21507cfc66939b422cb
2021/04/05 10:24:01 [INFO] Event name: issues
Error: /05 10:24:01 [ERROR] GET https://api.github.com/repos/orgs/[redacted]/issues/[redacted]/events: 404 Not Found []
Failed to get results from GitHub
main.validateGitHubRespons
	/app/main.go:282
main.getProjectCardsFromIssue
	/app/main.go:295
main.main
	/app/main.go:51
runtime.main
	/usr/local/go/src/runtime/proc.go:200
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1337

I don't think this is a problem with insufficient permissions, since I have tried a token with complete access to everything. Looking at the GitHub API, I think the issue lies in the orgs/[redacted] part of the request URL (the [redacted] part is our organization name that I have obscured). Surely the orgs part needs to be removed, since I couldn't find that this kind of endpoint exists for listing issue events.

@hampuslidin
Copy link
Author

hampuslidin commented Apr 5, 2021

I am not at all familiar with Go, but on closer inspection in the code, I believe the issue is that parentResource is unconditionally passed into the getProjectCardsFromIssue() function in main.go, which, for organizations, is parsed as the "orgs" literal in the projectParentName() function. For organization project URLs, the repository name is not present, so there would be a need to have an intermediary step between projectParentName() and getProjectCardsFromIssue() in order to determine the correct parentResource (owner).

@hampuslidin hampuslidin linked a pull request Apr 5, 2021 that will close this issue
@bort2012
Copy link

+ 1

@derl30n
Copy link

derl30n commented Jun 15, 2021

+1

@mfussenegger
Copy link

mfussenegger commented Jul 6, 2021

Maybe interesting for others: I also tried this plugin to auto add issues to an organization level project board and it also ran into the error reported here. I then ended up using the github CLI:

jobs:
  automate-projects:
    runs-on: ubuntu-latest
    steps:
      - name: Add issue to TOP SECRET project board
        run: gh issue edit $ISSUE_NUM --add-project "Secret Project Name"
        env:
          ISSUE_NUM: ${{github.event.issue.html_url}}
          GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

Creating a personal access token was necessary to give the github action access to the organization.
See https://github.blog/2021-03-11-scripting-with-github-cli/#using-gh-in-github-actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants