Skip to content

Commit 6484c57

Browse files
committed
refactor: consolidate to single job with multiple steps
1 parent cf17556 commit 6484c57

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

.github/workflows/non-english-warning.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ on:
88
- "!src/intl/en/**"
99

1010
jobs:
11-
check_branch_name:
11+
check_and_label:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Exit early if branch name contains 'crowdin' or is 'dev', 'staging', or 'master'
15-
id: check
15+
id: check_branch
1616
run: |
1717
if [[ "${{ github.head_ref }}" == *crowdin* ]] ||
1818
[[ "${{ github.ref }}" == 'refs/heads/dev' ]] ||
@@ -26,17 +26,13 @@ jobs:
2626
echo "::set-output name=skip::false"
2727
fi
2828
29-
check_changes:
30-
needs: check_branch_name
31-
if: needs.check_branch_name.outputs.skip == 'false'
32-
runs-on: ubuntu-latest
33-
outputs:
34-
all_changes_include_href: ${{ steps.check.outputs.all_changes_include_href }}
35-
steps:
3629
- name: Checkout code
30+
if: steps.check_branch.outputs.skip == 'false'
3731
uses: actions/checkout@v2
32+
3833
- name: Check changes
39-
id: check
34+
if: steps.check_branch.outputs.skip == 'false'
35+
id: check_changes
4036
run: |
4137
git fetch origin ${{ github.base_ref }}
4238
DIFF=$(git diff --no-ext-diff --unified=0 origin/${{ github.base_ref }}..${{ github.head_ref }} -- 'public/content/translations/**/*.md' 'src/intl/**/*.json' '!src/intl/en/**' | grep -E -v '^[-+]href=')
@@ -47,27 +43,24 @@ jobs:
4743
fi
4844
echo "::set-output name=all_changes_include_href::$ALL_CHANGES_INCLUDE_HREF"
4945
50-
add_label_and_comment:
51-
needs: check_changes
52-
runs-on: ubuntu-latest
53-
steps:
5446
- name: Add label and comment
47+
if: steps.check_branch.outputs.skip == 'false'
5548
uses: actions/github-script@v5
5649
with:
5750
github-token: ${{secrets.GITHUB_TOKEN}}
5851
script: |
5952
const prNumber = context.issue.number;
6053
const repo = context.repo;
6154
const prAuthor = context.payload.pull_request.user.login;
62-
const allChangesIncludeHref = '${{ needs.check_changes.outputs.all_changes_include_href }}' === 'true';
55+
const allChangesIncludeHref = '${{ steps.check_changes.outputs.all_changes_include_href }}' === 'true';
6356
const status = allChangesIncludeHref ? 'question ❓' : 'Status: Blocked 🛑';
6457
await github.rest.issues.addLabels({
6558
...repo,
6659
issue_number: prNumber,
6760
labels: [status, 'non-crowdin translation updates']
6861
});
6962
const commentWithoutHrefs = `This pull request contains changes to non-English content, which must also be handled through the Crowdin platform instead of only on GitHub.`
70-
const commentWithHrefs = `This pull request contains changes to non-English content files, which may also need to be handled through the Crowdin platform instead of only on GitHub.
63+
const commentWithHrefs = `This pull request contains changes to non-English content files, which may also need to be handled through the Crowdin platform instead of only on GitHub.`
7164
await github.rest.issues.createComment({
7265
...repo,
7366
issue_number: prNumber,
@@ -80,4 +73,4 @@ jobs:
8073
8174
Please post here or join [our Discord](https://ethereum.org/discord) if you have questions!
8275
`
83-
});
76+
});

0 commit comments

Comments
 (0)