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

fix: false positive error thrown by @octokit/auth-action due to env variables #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

TGTGamer
Copy link

See: https://github.com/octokit/auth-action.js?tab=readme-ov-file#createactionauth

Addresses issue by allowing users to input values as "with" option rather than "env"

New Features

  • Introduced automated dependency updates for GitHub Actions and npm packages.
  • Added ESLint configuration for linting TypeScript projects.
  • Implemented a workflow to check the integrity of transpiled JavaScript code.
  • Updated CI workflow with separate jobs for testing, linting, and GitHub Actions testing.
  • Set up CodeQL analysis for TypeScript code on main branch and pull requests.
  • Configured Prettier for code formatting with specific rules.
  • Added Release-Please to ensure release workflows.

Chores

Adjusted handling of environment variables in GitHub Actions for improved compatibility and flexibility.

TGTGamer and others added 3 commits February 14, 2024 12:58
* feat(eslint): add .eslintrc.yml configuration file

Add a new file `.eslintrc.yml` to the `.github/linters` directory to configure ESLint for the project. This configuration file includes the following changes:

- Set the environment to Node.js, ES6, and Jest.
- Define global variables `Atomics` and `SharedArrayBuffer` as readonly.
- Ignore specific patterns and files for linting.
- Use `@typescript-eslint/parser` as the parser.
- Set the parser options to use ECMAScript 2023 and module source type.
- Add plugins `@typescript-eslint` for TypeScript-specific rules.
- Extend the recommended ESLint rules and TypeScript-specific rules.
- Configure specific rules for the project.

The added configuration file will help enforce consistent code style and catch potential issues during development.

* chore(check-dist.yml): add workflow to check the transpiled JavaScript code in the dist/ directory
feat(ci.yml): add continuous integration workflow for TypeScript tests and GitHub Actions tests
feat(codeql-analysis.yml): add CodeQL workflow for code analysis

* chore(dependabot.yml): add Dependabot configuration file to enable automated dependency updates

The `.github/dependabot.yml` file is added to the repository. This file contains the configuration for Dependabot, a tool that automates dependency updates.

The configuration specifies two update groups:
- `actions-minor`: This group includes updates for minor and patch versions of GitHub Actions packages.
- `npm-development` and `npm-production`: These groups include updates for minor and patch versions of npm packages, with `npm-development` targeting development dependencies and `npm-production` targeting production dependencies.

The updates are scheduled to run weekly.

* chore(action.yml): add optional inputs for Github token, Bit cloud access token, Git user name, and Git user email to provide flexibility in configuration
fix(index.ts): fix linting issues by adding proper indentation and line breaks for better code readability
fix(init.ts): fix linting issues by adding proper indentation and line breaks for better code readability
feat(init.ts): add support for optional inputs for Git user name, Git user email, Bit cloud access token, and Github token to provide flexibility in configuration

* fix(index.js): fix error message quotes to use single quotes instead of double quotes for consistency
feat(index.js): add support for configurable environment variables for GIT_USER_NAME, GIT_USER_EMAIL, BIT_CLOUD_ACCESS_TOKEN, and GITHUB_TOKEN
fix(index.js): fix path concatenation in process.env.PATH to include the existing PATH value
fix(index.js): fix BIT_CONFIG_ANALYTICS_REPORTING, BIT_CONFIG_ANONYMOUS_REPORTING, and BIT_CONFIG_INTERACTIVE environment variables to use single quotes instead of double quotes for consistency
fix(index.js): fix command execution to use single quotes instead of double quotes for consistency

* chore: add .prettierignore file to exclude unnecessary directories and files from prettier formatting
chore: add .prettierrc.json file to configure prettier formatting options

* chore(package.json): update scripts to include additional commands for formatting, linting, and bundling

feat(package.json): add devDependencies for eslint and related plugins to enable linting and code formatting

The package.json file has been updated to include the following changes:

- Added a new script "bundle" which runs the "format:write" and "package" commands sequentially.
- Added new scripts "format:write" and "format:check" for formatting TypeScript files using Prettier.
- Added a new script "lint" which runs ESLint with a specific configuration file.
- Added a new script "package:watch" which runs the "package" command in watch mode.
- Added a new script "all" which runs the "format:write", "lint", and "package" commands sequentially.
- Added devDependencies for ESLint, TypeScript ESLint plugins, Prettier, and related packages.

These changes were made to improve the development workflow by providing convenient commands for code formatting, linting, and bundling.

* chore: update lock file

Signed-off-by: Jonathan Stevens <jonathan.stevens@eventiva.co.uk>

* chore(action.yml): add support for BIT_CONFIG_USER_TOKEN input to the action
fix(index.ts): set BIT_CONFIG_USER_TOKEN environment variable based on BIT_CLOUD_ACCESS_TOKEN input or environment variable
fix(init.ts): remove redundant setting of BIT_CLOUD_ACCESS_TOKEN environment variable

* chore(ci.yml): remove unused node-version-file configuration to simplify the workflow

* chore(ci.yml): add BIT_CLOUD_ACCESS_TOKEN and BIT_CONFIG_USER_TOKEN as environment variables to enable authentication with bit.cloud registry

* chore(tsconfig.json): add tsconfig.json file for linters configuration

This commit adds a new tsconfig.json file under the .github/linters directory. The tsconfig.json file is used to configure the TypeScript compiler options for linting purposes. The file extends the existing tsconfig.json file located at the root of the project and sets the "noEmit" option to true, which prevents the compiler from emitting any output files. The "include" property is set to include all files under the __tests__ and src directories, while the "exclude" property is set to exclude the dist, node_modules, coverage, test-data directories, and any JSON files. This configuration ensures that the linters only analyze the relevant TypeScript files and ignore unnecessary directories and files.

* chore(check-dist.yml): remove unused node-version-file configuration to simplify the workflow

* fix(index.ts, dist/index.js): refactor BIT_CLOUD_ACCESS_TOKEN and BIT_CONFIG_USER_TOKEN assignment to improve readability and maintain backward compatibility

The changes in both `index.ts` and `dist/index.js` files refactor the assignment of `BIT_CLOUD_ACCESS_TOKEN` and `BIT_CONFIG_USER_TOKEN` environment variables. The new code improves readability and maintains backward compatibility.

In `index.ts`:
- The assignment of `BIT_CLOUD_ACCESS_TOKEN` to `BIT_CONFIG_USER_TOKEN` is refactored using the nullish coalescing operator (`??`) to provide a fallback value from `core.getInput('BIT_CONFIG_USER_TOKEN')` if `BIT_CLOUD_ACCESS_TOKEN` is not set.

In `dist/index.js`:
- The assignment of `BIT_CLOUD_ACCESS_TOKEN` to `BIT_CONFIG_USER_TOKEN` is refactored using the nullish coalescing operator (`??`) to provide a fallback value from `core.getInput('BIT_CONFIG_USER_TOKEN')` if `BIT_CLOUD_ACCESS_TOKEN` is not set.
- The assignment of `BIT_CLOUD_ACCESS_TOKEN` to `BIT_CONFIG_USER_TOKEN` is also refactored using the nullish coalescing operator (`??`) to provide a fallback value from `BIT_CLOUD_ACCESS_TOKEN` if `process.env.BIT_CLOUD_ACCESS_TOKEN` is not set.

These changes improve the readability of the code and ensure that `BIT_CONFIG_USER_TOKEN` is assigned a value even if `BIT_CLOUD_ACCESS_TOKEN` is not set.

* chore(codeql-analysis.yml): remove unnecessary 'source-root' configuration from codeql-action init step

* fix(index.ts): change BIT_CONFIG_USER_TOKEN assignment to improve semantics and readability
fix(index.ts): add support for BIT_CONFIG_USER_TOKEN environment variable to be able to set the user token for Bit Cloud API

* fix(index.js): remove unused imports and variables to improve code readability and maintainability
feat(index.js): add support for setting GIT_USER_NAME, GIT_USER_EMAIL, and GITHUB_TOKEN environment variables from action inputs
fix(init.ts): remove unused imports and variables to improve code readability and maintainability

* chore(ci.yml): fix formatting issue in BIT_CONFIG_USER_TOKEN environment variable assignment

* chore(action.yml): add environment variables for BIT_CONFIG_USER_TOKEN, BIT_CLOUD_ACCESS_TOKEN, GIT_USER_NAME, GIT_USER_EMAIL, and GITHUB_TOKEN to the action configuration file
fix(index.ts, dist/index.js): refactor setting of environment variables for BIT_CONFIG_USER_TOKEN and BIT_CLOUD_ACCESS_TOKEN to improve readability and maintain backward compatibility

---------

Signed-off-by: Jonathan Stevens <jonathan.stevens@eventiva.co.uk>
…eases

The release-please.yml file is added to the .github/workflows directory. This file contains a workflow that is triggered on push events to the main branch. The workflow is named "release-please" and runs on the latest version of Ubuntu.

The workflow has a single job named "release-please" which has the following permissions: write access to contents and write access to pull requests. This allows the job to modify files and create pull requests.

The job consists of a single step that uses the "google-github-actions/release-please-action" action. The action is configured with the following parameters:
- token: The GitHub token used for authentication.
- config-file: The path to the release-please-config.json file.
- manifest-file: The path to the .release-please-manifest.json file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant