-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bfilar.nlu_signals
- Loading branch information
Showing
265 changed files
with
3,334 additions
and
1,102 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -8,13 +8,18 @@ on: | |
workflow_dispatch: {} | ||
|
||
concurrency: | ||
group: ${{ github.head_ref }} | ||
# For pull_request_target workflows we want to use head_ref -- the branch triggering the workflow. Otherwise, | ||
# use ref, which is the branch for a push event. | ||
group: ${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
tests: | ||
name: Run Rule Validation | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
contents: write | ||
checks: write | ||
|
||
steps: | ||
- name: Set up yq | ||
|
@@ -26,6 +31,16 @@ jobs: | |
ref: ${{ github.head_ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Add Rule IDs as Needed & Check for Duplicates | ||
# Run before testing, just in case this could invalidate the rule itself | ||
run: | | ||
pip install -r scripts/generate-rule-ids/requirements.txt | ||
python scripts/generate-rule-ids/main.py | ||
- name: Validate Rules | ||
run: | | ||
for f in *-rules/*.yml | ||
|
@@ -58,82 +73,41 @@ jobs: | |
run: | | ||
! /bin/sh -c 'ls **/*.yaml' | ||
rule-ids: | ||
name: Add Rule IDs & Validate Uniqueness | ||
runs-on: ubuntu-20.04 | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Add Rule IDs as Needed & Check for Duplicates | ||
run: | | ||
pip install -r scripts/generate-rule-ids/requirements.txt | ||
python scripts/generate-rule-ids/main.py | ||
- name: Commit & Push Results, if needed | ||
run: | | ||
rm response.txt | ||
if [ -z "$(git status --porcelain)" ]; then | ||
echo "No files changed, nothing to do" | ||
exit 0 | ||
fi | ||
git config user.name 'ID Generator' | ||
git config user.email '[email protected]' | ||
git add -A | ||
git add **/*.yml | ||
git commit -m "Auto add rule ID" | ||
git push origin ${{ github.head_ref }} | ||
- name: Get the head ref (eg branch) | ||
id: get_head | ||
run: git rev-parse HEAD > sha.txt | ||
|
||
- name: Upload SHA for later job | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: sha | ||
path: sha.txt | ||
|
||
# When the rule-ids job adds a commit, GitHub won't trigger actions on the auto commit. Various alternatives | ||
# were explored, but all run into issues when dealing with forks (well we'll see if this does too). | ||
set-checks: | ||
name: Set GH Checks Status | ||
runs-on: ubuntu-20.04 | ||
# Both must complete successfully. We assume that rule-ids does not break our rule validation (if we're not confident | ||
# we can change the ordering. | ||
needs: [rule-ids, tests] | ||
|
||
permissions: | ||
checks: write | ||
|
||
steps: | ||
|
||
- name: Download SHA from Previous Job | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: sha | ||
|
||
- name: Get the head ref (eg branch) | ||
- name: Get the head SHA | ||
id: get_head | ||
run: echo "##[set-output name=HEAD;]$(cat sha.txt)" | ||
run: echo "##[set-output name=HEAD;]$(git rev-parse HEAD)" | ||
|
||
# When we add a commit, GitHub won't trigger actions on the auto commit, so we're missing a required check on the | ||
# HEAD commit. | ||
# Various alternatives were explored, but all run into issues when dealing with forks. This sets a "Check" for | ||
# the latest commit, and we can depend on that as a required check. | ||
- name: "Create a check run" | ||
uses: actions/github-script@v6 | ||
if: github.event_name == 'pull_request_target' | ||
env: | ||
parameter_url: '${{ github.event.pull_request.html_url }}' | ||
with: | ||
debug: ${{ secrets.ACTIONS_STEP_DEBUG || false }} | ||
retries: 3 | ||
# Default includes 422 which GitHub returns when it doesn't know about the head_sha we set the status for. | ||
# This occurs when the previous push succeeds, but the checks/pull request component of GitHub isn't yet aware | ||
# of the new commit. This isn't the common case, but it comes up enough to be annoying. | ||
retry-exempt-status-codes: 400, 401, 403, 404 | ||
script: | | ||
// any JavaScript code can go here, you can use Node JS APIs too. | ||
// Docs: https://docs.github.com/en/rest/checks/runs#create-a-check-run | ||
|
@@ -147,8 +121,8 @@ jobs: | |
conclusion: "success", | ||
details_url: process.env.parameter_url, | ||
output: { | ||
title: "Rule Tests and ID Generation", | ||
summary: "Rule Tests and ID Generation", | ||
text: "Rule Tests and ID Generation", | ||
title: "Rule Tests and ID Updated", | ||
summary: "Rule Tests and ID Updated", | ||
text: "Rule Tests and ID Updated", | ||
}, | ||
}); |
This file contains 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 |
---|---|---|
|
@@ -51,7 +51,7 @@ jobs: | |
uses: lewagon/[email protected] | ||
with: | ||
ref: ${{ steps.comment-branch.outputs.head_sha }} | ||
check-name: 'Run Rule Validation' | ||
check-name: 'Rule Tests and ID Updated' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
wait-interval: 10 | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.