Is there a way to detect, if an issue is already in a project, like if: ${{ !contains(github.event.issue.projects.*.name, 'Board') }}
?
This is my situation: I have an action, which moves automatically new issues into my project "Board". But this action should only should run if the new issue isn't in the project "Board" already.
This is the currenct action:
name: new-issue-automation
on:
issues:
types: [opened]
env:
BOARD_NAME: "Board"
jobs:
move-new-issues-to-backlog:
# We don't want to move P0 issues to the backlog column
if: ${{ !contains(github.event.issue.labels.*.name, 'P0') }}
runs-on: ubuntu-latest
steps:
- uses: alex-page/github-project-automation-plus@v0.8.0
with:
project: ${{ env.BOARD_NAME }}
column: "Backlog"
# The normal GITHUB_TOKEN should have enough permission to edit the board. However, it seems so,
# that there is a GitHub bug. As a workaround we add an Personal GitHub Token (Nils Token)
repo-token: ${{ secrets.PROJECT_AUTOMATION_PLUS_TOKEN }}
But I watched into the attributes of the GitHub Context and there is no "project" attribute:
{
"token": "***",
"job": "one",
"ref": "refs/heads/main",
"sha": "a53e94dd74818acf6dcc60a433488b4573008867",
"repository": "nilsreichardt/playground",
"repository_owner": "nilsreichardt",
"repositoryUrl": "git://github.com/nilsreichardt/playground.git",
"run_id": "1033281712",
"run_number": "1",
"retention_days": "90",
"actor": "nilsreichardt",
"workflow": ".github/workflows/issue_test.yml",
"head_ref": "",
"base_ref": "",
"event_name": "issues",
"event": {
"action": "opened",
"issue": {
"active_lock_reason": null,
"assignee": null,
"assignees": [],
"author_association": "OWNER",
"body": "",
"closed_at": null,
"comments": 0,
"comments_url": "https://api.github.com/repos/nilsreichardt/playground/issues/19/comments",
"created_at": "2021-07-15T08:53:48Z",
"events_url": "https://api.github.com/repos/nilsreichardt/playground/issues/19/events",
"html_url": "https://github.com/nilsreichardt/playground/issues/19",
"id": 945154403,
"labels": [],
"labels_url": "https://api.github.com/repos/nilsreichardt/playground/issues/19/labels{/name}",
"locked": false,
"milestone": null,
"node_id": "MDU6SXNzdWU5NDUxNTQ0MDM=",
"number": 19,
"performed_via_github_app": null,
"repository_url": "https://api.github.com/repos/nilsreichardt/playground",
"state": "open",
"title": "test",
"updated_at": "2021-07-15T08:53:48Z",
"url": "https://api.github.com/repos/nilsreichardt/playground/issues/19",
"user": {
"avatar_url": "https://avatars.githubusercontent.com/u/24459435?v=4",
"events_url": "https://api.github.com/users/nilsreichardt/events{/privacy}",
"followers_url": "https://api.github.com/users/nilsreichardt/followers",
"following_url": "https://api.github.com/users/nilsreichardt/following{/other_user}",
"gists_url": "https://api.github.com/users/nilsreichardt/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/nilsreichardt",
"id": 24459435,
"login": "nilsreichardt",
"node_id": "MDQ6VXNlcjI0NDU5NDM1",
"organizations_url": "https://api.github.com/users/nilsreichardt/orgs",
"received_events_url": "https://api.github.com/users/nilsreichardt/received_events",
"repos_url": "https://api.github.com/users/nilsreichardt/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/nilsreichardt/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/nilsreichardt/subscriptions",
"type": "User",
"url": "https://api.github.com/users/nilsreichardt"
}
},
[...]
Is there a way to check the project in an action?