-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from github/jm_workflow_types
chore: standardize github action types
- Loading branch information
Showing
10 changed files
with
119 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
--- | ||
name: Auto Labeler | ||
name: Auto Labeler | ||
|
||
on: | ||
# pull_request_target event is required for autolabeler to support all PRs including forks | ||
pull_request_target: | ||
types: [opened, reopened, synchronize] | ||
on: | ||
# pull_request_target event is required for autolabeler to support all PRs including forks | ||
pull_request_target: | ||
types: [ opened, reopened, edited, synchronize ] | ||
|
||
permissions: | ||
contents: read | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
main: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
name: Auto label pull requests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
config-name: release-drafter.yml | ||
jobs: | ||
main: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
name: Auto label pull requests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
config-name: release-drafter.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Lint Code Base | |
|
||
on: | ||
pull_request: | ||
branches: main | ||
branches: [ main ] | ||
|
||
permissions: | ||
contents: read | ||
|
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"""Test the get_bool_env_var function""" | ||
|
||
import os | ||
import unittest | ||
from unittest.mock import patch | ||
|
||
from env import get_bool_env_var | ||
|
||
|
||
class TestEnv(unittest.TestCase): | ||
"""Test the get_bool_env_var function""" | ||
|
||
@patch.dict( | ||
os.environ, | ||
{ | ||
"TEST_BOOL": "true", | ||
}, | ||
clear=True, | ||
) | ||
def test_get_bool_env_var_that_exists_and_is_true(self): | ||
"""Test that gets a boolean environment variable that exists and is true""" | ||
result = get_bool_env_var("TEST_BOOL", False) | ||
self.assertTrue(result) | ||
|
||
@patch.dict( | ||
os.environ, | ||
{ | ||
"TEST_BOOL": "false", | ||
}, | ||
clear=True, | ||
) | ||
def test_get_bool_env_var_that_exists_and_is_false(self): | ||
"""Test that gets a boolean environment variable that exists and is false""" | ||
result = get_bool_env_var("TEST_BOOL", False) | ||
self.assertFalse(result) | ||
|
||
@patch.dict( | ||
os.environ, | ||
{ | ||
"TEST_BOOL": "nope", | ||
}, | ||
clear=True, | ||
) | ||
def test_get_bool_env_var_that_exists_and_is_false_due_to_invalid_value(self): | ||
"""Test that gets a boolean environment variable that exists and is false | ||
due to an invalid value | ||
""" | ||
result = get_bool_env_var("TEST_BOOL", False) | ||
self.assertFalse(result) | ||
|
||
@patch.dict( | ||
os.environ, | ||
{ | ||
"TEST_BOOL": "false", | ||
}, | ||
clear=True, | ||
) | ||
def test_get_bool_env_var_that_does_not_exist_and_default_value_returns_true(self): | ||
"""Test that gets a boolean environment variable that does not exist | ||
and default value returns: true | ||
""" | ||
result = get_bool_env_var("DOES_NOT_EXIST", True) | ||
self.assertTrue(result) | ||
|
||
@patch.dict( | ||
os.environ, | ||
{ | ||
"TEST_BOOL": "true", | ||
}, | ||
clear=True, | ||
) | ||
def test_get_bool_env_var_that_does_not_exist_and_default_value_returns_false(self): | ||
"""Test that gets a boolean environment variable that does not exist | ||
and default value returns: false | ||
""" | ||
result = get_bool_env_var("DOES_NOT_EXIST", False) | ||
self.assertFalse(result) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |