You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Replace the URL set on `GITHUB_PROJECT_URL` to the URL of your repository project to place issues
@@ -59,6 +68,8 @@ jobs:
59
68
60
69
User-based project is not supported yet
61
70
71
+
## Configurations
72
+
62
73
### Environment variables
63
74
64
75
| Environment variable | Value | Description |
@@ -68,6 +79,15 @@ User-based project is not supported yet
68
79
| GITHUB_PROJECT_COLUMN_NAME | Anything (e.g: To Do) | A GitHub Project column name you want to place new issues |
69
80
| DEBUG | Anything (e.g: true) | A flag to produce debug messages for this GitHub Actions if this environment variable exists |
70
81
82
+
### Condition with contexts
83
+
84
+
You can easily detect [event contexts](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#github-context) and use them in if statements. Here are some lists of the useful contexts for this GitHub action.
| github.event.action | opened, closed, edited, and so on | The name of actions (references for [issues](https://developer.github.com/v3/activity/events/types/#issuesevent) and for [pull_request](https://developer.github.com/v3/activity/events/types/#pullrequestevent) |
89
+
| github.event_name | [issues](https://developer.github.com/v3/activity/events/types/#webhook-event-name-19), [pull_quests](https://developer.github.com/v3/activity/events/types/#webhook-event-name-33) | The name of the event that triggered the workflow run |
infoLog("This GitHub event is neither issues nor pull_requests. Stop executing this action.")
23
+
infoLog("Please add 'if github.event_name' to the workflow yaml by following https://github.com/takanabe/add-new-issues-to-project-column/blob/master/README.md ")
24
+
os.Exit(0)
25
+
}
23
26
24
-
issueID:=extractIssueID(payload)
25
-
infoLog("New issue is found!!")
26
-
debugLog("Issue ID: %d\n", issueID)
27
+
// eventID stores issue ID or pull-request ID
28
+
vareventIDint64
29
+
varerrerror
30
+
ifeventName=="issues" {
31
+
payload:=issueEventPayload()
32
+
eventID, err=extractIssueID(payload)
33
+
errCheck(err)
34
+
} elseifeventName=="pull_request" {
35
+
payload:=pullRequestEventPayload()
36
+
eventID, err=extractPullRequestID(payload)
37
+
errCheck(err)
38
+
}
39
+
40
+
infoLog("Payload for %s extract correctly", eventName)
41
+
debugLog("Target event ID: %d\n", eventID)
27
42
28
43
client, ctx:=getGitHubClient()
29
44
30
45
url:=os.Getenv("GITHUB_PROJECT_URL")
31
46
ifurl=="" {
32
-
log.Println("[ERROR] Environment variable GITHUB_PROJECT_URL is not defined in your workflow file")
47
+
errorLog(errors.New("Environment variable GITHUB_PROJECT_URL is not defined in your workflow file"))
0 commit comments