Skip to content

Commit

Permalink
Remove GITHUB_TOKEN and add VERBOSE option.
Browse files Browse the repository at this point in the history
  • Loading branch information
st3fan committed Apr 20, 2021
1 parent bfc5902 commit 9b94b49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ Example usage:
- name: "Discover Fenix Beta Version"
id: fenix-beta-version
uses: mozilla-mobile/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name "Print the version number"
run: "The current Fenix Beta is $${{steps.fenix-beta-version.outputs.fenix-beta-version}}"
```
Expand Down
24 changes: 14 additions & 10 deletions src/fenix-beta-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ def is_fenix_beta_branch(fenix_repo, release_branch_name):

if __name__ == "__main__":

github_access_token = os.getenv("GITHUB_TOKEN")
if not github_access_token:
print("No GITHUB_TOKEN set. Exiting.")
sys.exit(1)

github = Github(github_access_token)
github = Github()
if github.get_user() is None:
print("Could not get authenticated user. Exiting.")
print("[E] Could not get authenticated user. Exiting.")
sys.exit(1)

verbose = os.getenv("VERBOSE") == "true"

organization = os.getenv("GITHUB_REPOSITORY_OWNER")
if not organization:
print("No GITHUB_REPOSITORY_OWNER set. Exiting.")
print("[E] No GITHUB_REPOSITORY_OWNER set. Exiting.")
sys.exit(1)

fenix_repo = github.get_repo(f"{organization}/fenix")

if verbose:
print(f"[I] Looking at Fenix at {fenix_repo.full_name}")

#
# Actual Action logic starts here. The strategy is very simple:
#
Expand All @@ -77,12 +77,16 @@ def is_fenix_beta_branch(fenix_repo, release_branch_name):

latest_fenix_version = get_latest_fenix_version(fenix_repo)
if not latest_fenix_version:
print(f"Could not determine current A-C version on {organization}/fenix")
print(f"[E] Could not determine current A-C version on {organization}/fenix")
sys.exit(1)

branch_name = f"releases_v{latest_fenix_version}.0.0"

if verbose:
print(f"[I] Looking at Fenix branch {organization}/fenix:{branch_name}")

if not is_fenix_beta_branch(fenix_repo, branch_name):
print(f"Branch {organization}/fenix:{branch_name} is not in beta")
print(f"[E] Branch {organization}/fenix:{branch_name} is not in beta")
sys.exit(1)

print(f"::set-output name=fenix-beta-version::{latest_fenix_version}")
Expand Down

0 comments on commit 9b94b49

Please sign in to comment.