Github action job fire when previous job skipped - github-actions

While setting up my GitHub action to build and deploy my apps, I'm running into the following issue.
I want to deploy my web app under the following conditions below. However, whenever deploy-api and deploy-sync skip deploy-web is also skipped. I figured that my if condition would catch that case and still run deploy-web but it isn't. Feels like I'm missing something obvious but can't identify it.
deploy-web:
name: Deploy Web
runs-on: ubuntu-latest
needs: [build-and-publish-web, deploy-api, deploy-sync]
if: |
needs.build-and-publish-web.result == 'success' &&
(needs.deploy-api.result == 'success' || needs.deploy-api.result == 'skipped') &&
(needs.deploy-sync.result == 'success' || needs.deploy-sync.result == 'skipped')

It seems like you encounter this issue - Job-level "if" condition not evaluated correctly if job in "needs" property is skipped.
Please try with always expression:
deploy-web:
name: Deploy Web
runs-on: ubuntu-latest
needs: [build-and-publish-web, deploy-api, deploy-sync]
if: |
always() &&
needs.build-and-publish-web.result == 'success' &&
(needs.deploy-api.result == 'success' || needs.deploy-api.result == 'skipped') &&
(needs.deploy-sync.result == 'success' || needs.deploy-sync.result == 'skipped')
Not specific to the original question but if all you care about is making sure there are no failures, needs.*.result provides wildcard behavior that prevents you from having to manually check each step:
if: |
always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')

Related

Why am I getting "Unexpected value ''" error in this GitHub action?

I have a GitHub action step like this (extracted from a larger test.yml file):
steps:
- name: Parse
shell: bash
env:
TYPE: ${{matrix.package-type}}
BV: ${{matrix.builder-version}}
# This comment is line 63, the "#" is in column 9
NULL: ${{ matrix.beta-version }}
run: |
echo TYPE is "$TYPE"
echo BV is "$BV"
printf "Null is '%s'\n" "$NULL"
When I run it, I get the following error:
The workflow is not valid. .github/workflows/test.yml (Line: 64, Col: 9): Unexpected value ''
Why is this line invalid? How do I fix it?
If you're using a reusable workflow, make sure you're not passing runs-on to the job that uses the workflow. The runs-on is contained in the workflow file itself, not in the top level job.
The workflow is not valid. .github/workflows/REDACTED.yml (Line: 123, Col: 5): Unexpected value 'uses' .github/workflows/REDACTED.yml (Line: 124, Col: 5): Unexpected value 'with'
It turns out there is some quirk in the GitHub action YAML parser that treats NULL as a special token. I guess it parses
NULL: ${{ matrix.beta-version }}
as if it were
'': ${{ matrix.beta-version }}
Changing NULL to null does not help. (Side note, keys to env must be unique when compared in a case-insensitive comparison, meaning you cannot have both FOO and foo, even though the case is preserved when setting the environment variable name.)
The best fix/workaround is to avoid using "NULL" and use something else, like "NIL". However, if you must use "NULL", you can do it by putting it in quotes:
"NULL": ${{ matrix.beta-version }}
In my case it was because go-version looked like this in the matrix section:
matrix:
go-version: 1.17
os: [ubuntu-latest, macos-latest]
It needed to be changed to an array: [1.17]

SharePoint View Formatting - IF Null AND

I have an SP list, and have formatted the view with some JSON but on the 'Open' I want to also included IF open AND "people picker field null" Basically I'm want to hightlight something that is open an unassigned to someone
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$Status] == 'Open', 'ms-bgColor-green ms-fontColor-black', if([$Status] == 'Closed', 'ms-bgColor-magentaLight ms-fontColor-black', if([$Status] == 'On Hold - 3rd Party', 'ms-bgColor-magentaLight ms-fontColor-black', if([$Status] == 'On Hold - 3rd Party', 'ms-bgColor-neutralLighterAlt ms-fontColor-black', if([$Status] == 'On Hold - User information', 'ms-bgColor-purpleLight ms-fontColor-black', if([$Status] == 'Closed', 'ms-bgColor-magentaLight ms-fontColor-black',if([$Status] == 'Request Completed Fulfilled','ms-bgColor-teal ms-fontColor-black' ,if([$Status] == 'Cancelled','ms-bgColor-yellow ms-fontColor-black', if([$Status] == 'Rejected Atlas','ms-bgColor-orangeLight ms-fontColor-black' if([$Status] == 'Rejected iHub','ms-bgColor-neutralSecondary ms-fontColor-black', ''))"
}
Any help would be cool
=if(#currentField <= #now && [$RAG] != 'Live', '#bc1010', '')"
&& is used as the and operator. In the example above, i'm looking to see if the time is now, and if the RAG column does not equal Live.

PhpStorm over-indenting multi-line functions

I'm currently attempting to configure PhpStorm to produce fully-PSR-2-compliant code, however its formatter is tripping up on long lines which contain functions with multiple parameters.
When I run the formatter, it converts this:
return ($thisIsALongLine || functionCall($arg1, $arg2));
into this:
return ($thisIsALongLine || functionCall(
$arg1,
$arg2
));
However, what I want is this:
return ($thisIsALongLine || functionCall(
$arg1,
$arg2
));
Does anyone know which formatter option tells it to further indent multi-line function calls in this instance?
Note: Usually, I'd format the above as this:
return ($thisIsALongLine
|| functionCall($arg1, $arg2));
However, that just bypasses the extra indentation issue, which I'd still need to fix for other situations.
Edit: This is the state of Wrapping and Braces, as requested by #LazyOne below:
Edit 2: Examples of two different types of line which PhpStorm's formatter isn't handling correctly. (Disclaimer: This is old code from a legacy system.)
Firstly, this:
if ($validateBudget && $this->getFinancialPeriodService()->validateBudget($formModel->action, $formModel->estimatedBudget, $formModel->startDate, $formModel->endDate, $formModel->isFirstPeriod)) {
becomes this:
if ($validateBudget && $this->getFinancialPeriodService()
->validateBudget($formModel->action, $formModel->estimatedBudget,
$formModel->startDate, $formModel->endDate, $formModel->isFirstPeriod)) {
when I would expect this based on the settings above:
if ($validateBudget && $this->getFinancialPeriodService()
->validateBudget(
$formModel->action,
$formModel->estimatedBudget,
$formModel->startDate,
$formModel->endDate,
$formModel->isFirstPeriod
)
) {
Secondly, if you enable alignment on chained methods, then this:
if ($evaluation->getExpert() != NULL && ($evaluation->getExpert()->getStatusId() == Evaluation::STATUS_ASSIGNED || $evaluation->getEvaluationStage() == Evaluation::STAGE_PROPOSED && CoreDateUtils::dateIsPast($proposal->getCalendar()->getStage1StartDate()) == false || $evaluation->getEvaluationStage() == Evaluation::STAGE_IN_PROGRESS && CoreDateUtils::dateIsPast($proposal->getCalendar()->getStage2StartDate()) == false)) {
is reformatted to this:
if ($evaluation->getExpert() != null && ($evaluation->getExpert()
->getStatusId() == Evaluation::STATUS_ASSIGNED || $evaluation->getEvaluationStage() == Evaluation::STAGE_PROPOSED && CoreDateUtils::dateIsPast($proposal->getCalendar()
->getStage1StartDate()) == false || $evaluation->getEvaluationStage() == Evaluation::STAGE_IN_PROGRESS && CoreDateUtils::dateIsPast($proposal->getCalendar()
->getStage2StartDate()) == false)) {
when I would expect this:
if ($evaluation->getExpert() != null
&& ($evaluation->getExpert()->getStatusId() == Evaluation::STATUS_ASSIGNED
|| $evaluation->getEvaluationStage() == Evaluation::STAGE_PROPOSED
&& CoreDateUtils::dateIsPast($proposal->getCalendar()->getStage1StartDate()) == false
|| $evaluation->getEvaluationStage() == Evaluation::STAGE_IN_PROGRESS
&& CoreDateUtils::dateIsPast($proposal->getCalendar()->getStage2StartDate()) == false)
) {
To be honest, at this point I suspect a bug in the formatter, so will open a ticket with JetBrains, however I'll leave this open in case anyone does know why it over-/underformats things.

Unable to send data to FPDF

I have a php page called page2.php which is connected to database via conectionDB.php and uploadChannel1.php to upload images. I have html page channel1.html where my form is.
But I need to send the input to FPDF to print it or save it, but this error keeps showing
Fatal error: Uncaught exception 'Exception' with message 'FPDF error: Some data has already been output, can't send PDF file'
I used ob_start and ob_flush and ob_clean and others but still not working I know the problem is with my php code. Please guys help me in this one.
require 'connectionDB.php';
require 'channel1.html';
require 'uploadChannel1.php';
if(isset($_POST['stdName']) && isset($_POST['secondGrand'])&& isset($_POST['grandName']) && isset($_POST['fatherAName']) && isset($_POST['motherGrand']) && isset($_POST['motherFatherName']) && isset($_POST['motherName']) && isset($_POST['subjectNum']) && isset($_POST['TotalNum'])&& isset($_POST['Avg']) && isset($_POST['birthDate']) && isset($_POST['gender']) && isset($_POST['stdType'])&& isset($_POST['jobs']) && isset($_POST['city'])&& isset($_POST['phone'])&& isset($_POST['bookDate'])&& isset($_POST['bookNo']))
{
$student=sanitizeString($_POST['stdName']);
$grand2=sanitizeString($_POST['secondGrand']);
$grand1=sanitizeString($_POST['grandName']);
$father=sanitizeString($_POST['fatherAName']);
$motherGrand=sanitizeString($_POST['motherGrand']);
$motherFather=sanitizeString($_POST['motherFatherName']);
$mother=sanitizeString($_POST['motherName']);
$subNo= sanitizeString($_POST['subjectNum']);
$Total=sanitizeString($_POST['TotalNum']);
$avg=sanitizeString($_POST['Avg']);
$graduateDate=sanitizeString($_POST['graduateYear']);
$birth=sanitizeString($_POST['birthDate']);
$gender=sanitizeString($_POST['gender']);
$job=sanitizeString($_POST['jobs']);
$stdType=sanitizeString($_POST['stdType']);
$City=sanitizeString($_POST['city']);
$tel=sanitizeString($_POST['phone']);
$bookdate=sanitizeString($_POST['bookDate']);
$bookNum=sanitizeString($_POST['bookNo']);
if(!empty($student) &&!empty($grand2) &&!empty($grand1) &&!empty($father)&&!empty($motherGrand)&&!empty($motherFather)&&!empty($mother)&&!empty($subNo)&&!empty($Total)&&!empty($avg)&&!empty($graduateDate)&&!empty($birth)&&!empty($gender)&&!empty($stdType)&&!empty($City)&&!empty($tel) && !empty($bookdate) &&!empty($bookNum) &&!empty($job))
{
session_start();
$_SESSION['stdName] =$studen ;
}
.......

SSIS Derived column Transformation setting to BOOL with UPPER(LTRIM(RTRIM

I have a Flag which needs to be set to 1 or 0. so i used Derived column transformation to convert it to bool
as you can se the code it works only when i use an OR operator for both Y and N .
This code below works for IF Flag is Y and N condition
(DT_BOOL)(Flag == "Y" ? 1 : 0) || (DT_BOOL)(Flag == "N" ? 0 : 1)
** working only when FLAG = (Capital)Y OR N *****************
but if my Flag is small 'n' it does not work it still sets to TRUE
I want to make it UPPER and TRIM it at the same time . Which i am having hard time to figure out .
This is my code but it does not work
(DT_BOOL)(UPPER(RTRIM(LTRIM
(Flag == "Y" ? 1 : 0)
)))
||(DT_BOOL)(UPPER(RTRIM(LTRIM(Flag == "N" ? 0 :1)
))) ***** this code is not working *****************
Thanks for your time.
PLEASE look at Tranformation Pic
Try this...
(DT_BOOL)(UPPER(RTRIM(LTRIM(Flag))) == "N" ? 0 :1)