Comments (1)
The code you have provided is an if statement that checks if the following conditions are met:
The repository owner is not githublearn.
The event name is either workflow_dispatch or the pull request has been merged and the head ref is pr_branch_name.
If all of these conditions are met, the if statement will execute the code that follows it.
This code could be used to run a workflow only if the repository owner is not githublearn and the event is either a workflow dispatch or a pull request that has been merged and the head ref is pr_branch_name.
For example, you could use this code to run a workflow that deploys a new version of your application to production only if the repository owner is not githublearn and the pull request has been merged and the head ref is pr_branch_name.
Here is a breakdown of the code:
if: >-
${{
github.repository_owner != 'githublearn' &&
(
github.event_name == 'workflow_dispatch' ||
(
github.event.pull_request.merged == true &&
github.head_ref == 'pr_branch_name'
)
)
}}
The first line of the code is the if keyword. This keyword tells GitHub that the following code should only be executed if the conditions inside the curly braces are met.
The next line of code is a nested conditional statement. This statement checks if the following conditions are met:
The repository owner is not githublearn.
The event name is either workflow_dispatch or the pull request has been merged and the head ref is pr_branch_name.
The && operator is used to combine the two conditions. This means that both conditions must be met for the nested conditional statement to be true.
If the nested conditional statement is true, the if statement will execute the code that follows it.
from introduction-to-github.
Related Issues (20)
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 introduction-to-github.