Title: Can't seem to trigger a job based on text in the opening comment · Issue #496 · actions/github-script · GitHub
Open Graph Title: Can't seem to trigger a job based on text in the opening comment · Issue #496 · actions/github-script
X Title: Can't seem to trigger a job based on text in the opening comment · Issue #496 · actions/github-script
Description: @joshmgross ... Hello! Could you help me again with a thorny conditional check for running a job? Earlier, we were working with conditionals for issue labels. Now, I need to run a job based on opening issue body content. Our situation fo...
Open Graph Description: @joshmgross ... Hello! Could you help me again with a thorny conditional check for running a job? Earlier, we were working with conditionals for issue labels. Now, I need to run a job based on open...
X Description: @joshmgross ... Hello! Could you help me again with a thorny conditional check for running a job? Earlier, we were working with conditionals for issue labels. Now, I need to run a job based on open...
Opengraph URL: https://github.com/actions/github-script/issues/496
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can't seem to trigger a job based on text in the opening comment","articleBody":"@joshmgross ... Hello! Could you help me again with a thorny conditional check for running a job? Earlier, we were working with [conditionals for issue labels](https://github.com/actions/github-script/issues/441). Now, I need to run a job based on opening issue body content.\r\n\r\nOur situation for Microsoft ASP.NET Core docs (the official doc set) is that we're having some instability on getting a tool called \"Repoman\" to run and apply labels correctly to newly opened issues. The maintainer of Repoman thinks that there has been some changes in hosting that are interfering with that tool running. When Repoman works, it applies some opening labels, and then my GH workflow sees one of the labels (`blazor/subsvc`) and runs a job. Since Repoman is having trouble getting labels affixed to issues when they're opened, I'm looking for a way for my workflow to run directly and not use Repoman's applied labels.\r\n\r\nWe have some stable body content (a URL in the opening issue comment) that I can search for.\r\n\r\nHere's an example issue: https://github.com/dotnet/AspNetCore.Docs/issues/33931\r\n\r\nYou see there that we have the article link in the body of the opening comment. For example, any Blazor issue that's opened will have a link like this ...\r\n\r\n\u003e https://learn.microsoft.com/en-us/aspnet/core/blazor/...?view=aspnetcore-8.0\r\n\r\n... in the body of the opening comment, so I think if I can just compose an `if:` to find the text \"`aspnet/core/blazor`\" that I would be able to get my jobs to run.\r\n\r\nTherefore, I'm trying `if: contains(github.event.comment.body, 'aspnet/core/blazor')`. Below, I'm showing the line change from looking at a label to a line that checks the body content. However, that change didn't work in testing. It doesn't throw an error, but the conditional fails and the job doesn't run.\r\n\r\nCan you see where I'm going wrong with that `if:` statement? I suspect the check on `github.event.comment.body` is incorrect. I've checked the API docs, but I find it difficult to understand the chaining of properties on the context (`github.event`) for simple use case scenarios like this. I still wish there were many more `if:` examples for common use cases in the docs. Anyway, can you give me a tip on getting this approach to work?\r\n\r\n```diff\r\nname: Issue processing\r\non:\r\n issues:\r\n types:\r\n - opened\r\njobs:\r\n process-blazor-issue:\r\n- if: github.event.label.name == 'blazor/subsvc'\r\n+ if: contains(github.event.comment.body, 'aspnet/core/blazor')\r\n runs-on: ubuntu-latest\r\n permissions:\r\n issues: write\r\n steps:\r\n - uses: actions/github-script@v6\r\n with:\r\n script: |\r\n await ...\r\n await ...\r\n await ...\r\n await ...\r\n await ...\r\n await ...\r\n```","author":{"url":"https://github.com/guardrex","@type":"Person","name":"guardrex"},"datePublished":"2024-10-25T13:26:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/496/github-script/issues/496"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f1435cff-ef4a-26b7-89a4-b4ad2512340e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED0A:2395E2:1877575:22BBE2D:6A50C76A |
| html-safe-nonce | f2e4b98a9404c85fb60a6d0496fce4f73eef64857c5723a0d25e45943398c7ae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDBBOjIzOTVFMjoxODc3NTc1OjIyQkJFMkQ6NkE1MEM3NkEiLCJ2aXNpdG9yX2lkIjoiMTgxMDE4NzM0MzkwNDE2MzY5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d03188e3abfe9c033d6f3b84dc46845fbd3070aa284a4b38a9d001060e97a8cc |
| hovercard-subject-tag | issue:2614109876 |
| github-keyboard-shortcuts | repository,issues,actions,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/actions/github-script/496/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cdf03d820576ce6e96f8430295362cc87a97973ac0270d1fc954a4ebba5358d5/actions/github-script/issues/496 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cdf03d820576ce6e96f8430295362cc87a97973ac0270d1fc954a4ebba5358d5/actions/github-script/issues/496 |
| og:image:alt | @joshmgross ... Hello! Could you help me again with a thorny conditional check for running a job? Earlier, we were working with conditionals for issue labels. Now, I need to run a job based on open... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | guardrex |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| turbo-cache-control | no-preview |
| go-import | github.com/actions/github-script git https://github.com/actions/github-script.git |
| octolytics-dimension-user_id | 44036562 |
| octolytics-dimension-user_login | actions |
| octolytics-dimension-repository_id | 205262760 |
| octolytics-dimension-repository_nwo | actions/github-script |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 205262760 |
| octolytics-dimension-repository_network_root_nwo | actions/github-script |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 08e79d53fc070870d5b168356afebb1e286a2ffe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width