generated from actions/hello-world-docker-action
-
Notifications
You must be signed in to change notification settings - Fork 2
Ensure newline literals (\n) are quoted to the correct level #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jeddai
merged 2 commits into
main
from
jhugman/exp-3605-format-carriage-returns-correctly
Jun 22, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,48 @@ | ||
| #!/bin/bash | ||
| # This Source Code Form is subject to the terms of the Mozilla Public | ||
| # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| # file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| git config --global --add safe.directory "/github/workspace/$1" | ||
|
|
||
| cd $1 | ||
| export DATA=$(curl $3 | jq --arg APP_NAME "$4" '{"data":map(select(.appName == $APP_NAME))}') | ||
|
|
||
| if [[ $2 =~ .*\.json ]]; then | ||
| echo -e "$DATA" > $2 | ||
| # elif [[ $2 =~ .*\.swift ]]; then | ||
| # echo -e "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not distributed with this\n// file, You can obtain one at http://mozilla.org/MPL/2.0/\n\nimport Foundation\n\npublic struct FirstRunExperiments {\n public static let value = \"\"\"$DATA\"\"\"\n}" > $2 | ||
| # elif [[ $2 =~ .*\.kt ]]; then | ||
| # if [[ -z $6 ]]; then | ||
| # echo "Package is not specified. Package is a required value for the kotlin language." | ||
| # exit 1 | ||
| # fi | ||
| # echo -e "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not distributed with this\n// file, You can obtain one at http://mozilla.org/MPL/2.0/\n\npackage $6\n\n/*\n * This is a list of the first-run experiments. It will be passed to Nimbus during startup.\n */\nconst val firstRunExperiments = \"\"\"$DATA\"\"\"" > $2 | ||
| else | ||
| DIR="$1" | ||
| FILENAME="$2" | ||
| URL="$3" | ||
| APP_NAME="$4" | ||
| BRANCH="$5" | ||
|
|
||
| if [[ ! $FILENAME =~ .*\.json ]]; then | ||
| echo "Language of output file is not supported. Please set the output to a JSON file." | ||
| exit 1 | ||
| fi | ||
|
|
||
| git config --global --add safe.directory "/github/workspace/$DIR" | ||
| pushd "$DIR" || exit 1 | ||
|
|
||
| curl "$URL" | jq --arg APP_NAME "$APP_NAME" '{"data":map(select(.appName == $APP_NAME))}' > "$FILENAME" | ||
|
|
||
| git status | ||
| export CHANGED=$(git status -s | wc -l) | ||
| export CHANGED_BRANCH=0 | ||
| CHANGED=$(git status -s | wc -l) | ||
| CHANGED_BRANCH=0 | ||
|
|
||
| git add $2 | ||
| git add "$FILENAME" | ||
| echo "$CHANGED file(s) have been modified" | ||
|
|
||
| export REMOTE_BRANCH=$(git ls-remote --head origin $5) | ||
| REMOTE_BRANCH=$(git ls-remote --head origin "$BRANCH") | ||
| if [[ -z $REMOTE_BRANCH ]]; | ||
| then | ||
| export CHANGED_BRANCH=1 | ||
| CHANGED_BRANCH=1 | ||
| echo "Remote branch currently does not exist; outputting that there are changes." | ||
| else | ||
| export CHANGED_BRANCH=$(git --no-pager diff origin/$5 | grep $2 | wc -l) | ||
| if test $CHANGED_BRANCH -ge 1 | ||
| CHANGED_BRANCH=$(git --no-pager diff "origin/$BRANCH" | grep -c "$FILENAME") | ||
| if test "$CHANGED_BRANCH" -ge 1 | ||
| then | ||
| export CHANGED=1 | ||
| CHANGED=1 | ||
| echo "Remote branch differs from current changes, it should be updated." | ||
| else | ||
| echo "Remote branch and current changes are equivalent." | ||
| fi | ||
| fi | ||
|
|
||
| echo "changed=$CHANGED" >> $GITHUB_OUTPUT | ||
| echo "changed-branch=$CHANGED_BRANCH" >> $GITHUB_OUTPUT | ||
| echo "changed=$CHANGED" >> "$GITHUB_OUTPUT" | ||
| echo "changed-branch=$CHANGED_BRANCH" >> "$GITHUB_OUTPUT" | ||
|
|
||
| popd 2>/dev/null || exit 0 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.