Comments (9)
My
if
condition is very larger in size and I want to write it in multiple lines. Is there any way to do that?
Much like you would use |
, use >-
(the "block styles with block chomping indicator"). Unlike |
, it strips the the newlines (and doesn't leave a newline at the end). For more info see https://stackoverflow.com/a/21699210/3217306
- name: Running all tests
if: >-
startsWith(github.event.comment.body, '/run-e2e-all') ||
startsWith(github.event.comment.body, '/run-e2e-first-test') ||
startsWith(github.event.comment.body, '/run-e2e-second-test') ||
startsWith(github.event.comment.body, '/run-e2e-third-test')
# etc.
run: |
echo "Hello all"
from request-action.
I tried many routes, what ended up working for me is adding an additional |
to tell yaml.safeLoad, that it is actually reading a multi-line string.
...
body: |
|
My muti-line comment
- [ ] a
- [ ] b
...
from request-action.
A similar type of issue I'm facing:
My if
condition is very larger in size and I want to write it in multiple lines. Is there any way to do that?
- name: Running all tests
if: startsWith(github.event.comment.body, '/run-e2e-all') || startsWith(github.event.comment.body, '/run-e2e-first-test') || startsWith(github.event.comment.body, '/run-e2e-second-test') || startsWith(github.event.comment.body, '/run-e2e-third-test') || startsWith(github.event.comment.body, '/run-e2e-fourth-test') || startsWith(github.event.comment.body, '/run-e2e-fifth-test') || startsWith(github.event.comment.body, '/run-e2e-sixth-test') || startsWith(github.event.comment.body, '/run-e2e-seventh-test') || startsWith(github.event.comment.body, '/run-e2e-eighth-test') || startsWith(github.event.comment.body, '/run-e2e-nineth-test') || startsWith(github.event.comment.body, '/run-e2e-tenth-test')
run: |
echo "Hello all"
from request-action.
@gr2m, I think the problem is simple to understand now. The values in the with
section for octokit/request-action
, are always interpreted as yaml documents, and not literally as strings.
I will try to create a simpler test case to reproduce the problem.
from request-action.
I'm glad you got it working! We added the yaml.safeLoad
to allow parameters to be set to JSON strings, so object parameters can be supported. It sounds very odd that it removes the new lines ... your workaround looks odd to me, too. I feel like there should be proper way to do this, but I don't have the time to look into it myself right now, maybe you or someone else can dig into this?
from request-action.
@gr2m, since this issue is closed what is the recommended method for passing in a multi-line body
? Is it still to double-up the pipe as in #6 (comment)?
from request-action.
Good question! I think that a single |
should suffice, could you please give it a try?
from request-action.
Good question! I think that a single | should suffice, could you please give it a try?
I ask because I was still seeing issues with a multi-line body, but there may be an additional factor at play. For us, we're seeing an error when the multi-line body includes colon (:) characters. I'll create a new issue.
from request-action.
we're seeing an error when the multi-line body includes colon (:) characters. I'll create a new issue.
Ah I think I know what's happening. Yes, let's discuss in the new issue
from request-action.
Related Issues (20)
- Cannot view repo details
- [DOCS]: handleError example does not handle errors HOT 1
- [BUG]: sensitive output (`actions/runners/registration-token`) can't be masked HOT 3
- [DOCS]: Example of required_status_checks on branch protection ON HOT 1
- [ASK]: What is GITHUB_TOKEN?? HOT 1
- "Resource not accessible by integration" HOT 2
- [BUG]: Deprecation of GitHub Actions save-state and set-output commands
- Request Dependency Updates for dcl-node-runtime and vm HOT 2
- Having this problem "Bad Credentials" HOT 8
- > I see some repositories using `npm run build` HOT 1
- [MAINT]: Update runtime to Node 20 HOT 2
- [FEAT]: Support onprem github api calls HOT 3
- [BUG]: Attempting GET on a Github commit API fails HOT 5
- [FEAT]: Add fail_on_error option to suppress failing HOT 1
- How to call add Tag? HOT 1
- [Question]: How to use this action with `POST /repos/{owner}/{repo}/check-runs` HOT 4
- [DOCS]: Clarify how to set body inputs HOT 3
- [MAINT]: Node.js 16 deprecation warning HOT 2
- [BUG]: Proxy error HOT 2
- [BUG]: Available inputs not correctly listed in action.yml HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from request-action.