Skip to content
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

feat: actionlint #498

Merged
merged 6 commits into from
Mar 30, 2022
Merged

feat: actionlint #498

merged 6 commits into from
Mar 30, 2022

Conversation

guidojw
Copy link
Member

@guidojw guidojw commented Mar 14, 2022

Summary

Runs some checks on our workflow files.

Other information

https://github.com/rhysd/actionlint

@guidojw guidojw enabled auto-merge (squash) March 14, 2022 23:19
@guidojw guidojw requested a review from DrumsnChocolate March 16, 2022 13:03
@@ -44,7 +44,7 @@ jobs:
env:
INPUT_MERGE: ${{ github.event.inputs.merge }}
run: |
if [ $GITHUB_REF_NAME = 'master' ]; then
if [ "$GITHUB_REF_NAME" = 'master' ]; then
if [ "${INPUT_MERGE,,}" = 'y' ]; then
git fetch origin staging
if ! git diff origin/master origin/staging --exit-code; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't related to this commit, but I'm wondering whether this condition is not the wrong way around; doesn't a non-zero exit code mean that there's differences between branches? According to man git-diff:

   --exit-code
      Make the program exit with codes similar to diff(1). That is, it
      exits with 1 if there were differences and 0 means no differences.

Wouldn't that then mean that a truthy exit code means differences, and passing the exit code through a negation results in true when no diff?
that is, shouldn't it be:
if git diff --exit-code ... has_diff=true else has_diff=false? rather than
if ! git diff --exit-code ... has_diff=true else has_diff=false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An exit code of 1 means the program has failed, and this negates that to a success and thus makes it pass the condition.

@guidojw guidojw merged commit a8c344d into staging Mar 30, 2022
@guidojw guidojw deleted the feat/actionlint branch March 30, 2022 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants