Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 70 additions & 28 deletions .github/CONTRIBUTING.md
Comment thread
nathanosdev marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contributing

Thank you for your interest in contributing to this repo.
Thank you for your interest in contributing to DFINITY's CI Tools.
By participating in this project, you agree to abide by our [Code of Conduct](./CODE_OF_CONDUCT.md).

As a member of the community, you are invited and encouraged to contribute by submitting issues, offering suggestions for improvements, adding review comments to existing pull requests, or creating new pull requests to fix issues.

All contributions to DFINITY documentation and the developer community are respected and appreciated.
Your participation is an important factor in the success of the Internet Computer.

## Before you contribute
## Prerequisites

Before contributing, please take a few minutes to review these contributor guidelines.
The contributor guidelines are intended to make the contribution process easy and effective for everyone involved in addressing your issue, assessing changes, and finalizing your pull requests.
Expand All @@ -27,16 +27,7 @@ Before contributing, consider the following:

If you are new to working with GitHub repositories and creating pull requests, consider exploring [First Contributions](https://github.com/firstcontributions/first-contributions) or [How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).

# How to make a contribution

Depending on the type of contribution you want to make, you might follow different workflows.

This section describes the most common workflow scenarios:

- Reporting an issue
- Submitting a pull request

### Reporting an issue
## Reporting an issue

To open a new issue:

Expand All @@ -45,35 +36,86 @@ To open a new issue:
- Be as clear and descriptive as possible.
- For any problem, describe it in detail, including details about the crate, the version of the code you are using, the results you expected, and how the actual results differed from your expectations.

### Submitting a pull request
## Submitting a pull request

If you want to submit a pull request to fix an issue or add a feature, here's a summary of what you need to do:

### Forking the repository

1. Make sure you have a GitHub account, an internet connection, and access to a terminal shell or GitHub Desktop application for running commands.
2. Navigate to the [repository's homepage](https://github.com/dfinity/ci-tools) in a web browser.
3. Click **Fork** to create a copy of the repository under your GitHub account or organization name.
4. Clone the forked repository to your local machine.
5. Create a new branch for your fix by running a command similar to the following:
```shell
git checkout -b my-branch-name-here
git clone "https://github.com/$YOUR_USERNAME/ci-tools.git"
```
6. Open the file you want to fix in a text editor and make the appropriate changes for the issue you are trying to address.
7. Add the file contents of the changed files to the index `git` uses to manage the state of the project by running a command similar to the following:
5. Change into the directory of the cloned repository:
```shell
git add path-to-changed-file
cd ci-tools
```
8. Commit your changes to store the contents you added to the index along with a descriptive message by running a command similar to the following:
6. Create a new branch for your fix by running a command similar to the
following:
```shell
git switch -c $YOUR_BRANCH_NAME
```

### Install dependencies

- Install [`fnm`](https://github.com/Schniz/fnm).
- Install the correct version of [`nodejs`](https://nodejs.org).
```bash
fnm install
```
- Enable the correct version of `nodejs`.
```bash
fnm use
```
- Set up the correct version of [`pnpm`](https://pnpm.io/).
```bash
corepack enable
```
- Install dependencies:
```bash
pnpm i
```

### Making a pull request

1. Open the file you want to fix in a text editor and make the appropriate changes for the issue you are trying to address.
2. Add the file contents of the changed files to the index `git` uses to manage the state of the project by running a command similar to the following:
```shell
git add $PATH_TO_CHANGED_FILE
```
3. Make sure to have [Commitizen](https://commitizen-tools.github.io/commitizen/#installation) installed.
4. Commit your changes to store the contents you added to the index along with a descriptive message by running the following:
```shell
cz commit
```
- See [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for more information on the commit message formats.
9. Push the changes to the remote repository by running a command similar to the following:
5. Push the changes to the remote repository by running a command similar to the following:
```shell
git push origin my-branch-name-here
git push origin $YOUR_BRANCH_NAME
```
10. Create a new pull request (PR) for the branch you pushed to the upstream GitHub repository.
- The PR title should be auto-populated based on your commit message.
- Provide a PR message that includes a short description of the changes made.
11. Wait for the pull request to be reviewed.
12. Make changes to the pull request, if requested.
13. Celebrate your success after your pull request is merged!
6. Create a new pull request (PR) for the branch you pushed to the upstream GitHub repository.
- The PR title should be auto-populated based on your commit message.
- Provide a PR message that includes a short description of the changes made.
7. Wait for the pull request to be reviewed.
8. Make changes to the pull request, if requested. When making subsequent commits, you no longer need to follow conventional commits. Only the first commit message will be used.
9. Celebrate your success after your pull request is merged!

## Updating `pnpm`

To update the version of `pnpm` that is used:

```bash
corepack use pnpm@10.x
```

## Building

Actions are built locally and the built files are committed to the repository. To build the actions, run:

```bash
pnpm build
```

The GitHub actions pipeline will attempt to build the actions and check if there are any differences between the built files and those that are committed to the repository. If there are any differences, the pipeline will fail.
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Provide additional contextual information about the code changes below this line, then remove this line. -->

<!-- If relevant, provide additional information about breaking changes after the `BREAKING CHANGE` prefix on the following line, then remove this line. Remove the following line if there are no breaking changes. -->

<!--
BREAKING CHANGE:
-->

<!-- If relevant, add a reference to an issue on the following line, then remove this line. Remove the following line if there are no relevant issues. -->

<!--
Ref: #<issue number>
-->
6 changes: 3 additions & 3 deletions .github/actions/check-dist/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Check dist'
name: Check dist
description: 'Builds an action and ensures the `dist/` directory is up to date'

inputs:
Expand All @@ -9,12 +9,12 @@ inputs:
runs:
using: 'composite'
steps:
- name: 'Build action'
- name: Build action
shell: bash
working-directory: actions/${{ inputs.action_name }}
run: pnpm build

- name: 'Check action `dist` directory'
- name: Check action `dist` directory
shell: bash
working-directory: actions/${{ inputs.action_name }}
run: |
Expand Down
5 changes: 5 additions & 0 deletions .github/repo_policies/BOT_APPROVED_FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# List of approved files that can be changed by a bot via an automated PR.
# This is to increase security and prevent accidentally updating files that shouldn't be changed by a bot.

cz.json
CHANGELOG.md
12 changes: 6 additions & 6 deletions .github/workflows/check-commit-messages.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Check commit messages workflow'
name: Check commit messages workflow

on:
workflow_call:
Expand All @@ -13,18 +13,18 @@ jobs:
check_commit_messages:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: 'Setup Python'
- name: Setup Python
uses: dfinity/ci-tools/actions/setup-python@main

- name: 'Setup Commitizen'
- name: Setup Commitizen
uses: dfinity/ci-tools/actions/setup-commitizen@main

- name: 'Check commit messages'
- name: Check commit messages
uses: dfinity/ci-tools/actions/check-commit-messages@main
with:
target_branch: ${{ inputs.target_branch }}
34 changes: 0 additions & 34 deletions .github/workflows/check-dist.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/check-formatting.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/check-pr-title.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Check PR title workflow'
name: Check PR title workflow

on:
workflow_call:
Expand All @@ -7,11 +7,11 @@ jobs:
check_pr_title:
runs-on: ubuntu-latest
steps:
- name: 'Setup Python'
- name: Setup Python
uses: dfinity/ci-tools/actions/setup-python@main

- name: 'Setup Commitizen'
- name: Setup Commitizen
uses: dfinity/ci-tools/actions/setup-commitizen@main

- name: 'Check pull request title'
- name: Check pull request title
uses: dfinity/ci-tools/actions/check-pr-title@main
18 changes: 9 additions & 9 deletions .github/workflows/generate-changelog.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Generate changelog workflow'
name: Generate changelog workflow

on:
workflow_call:
Expand Down Expand Up @@ -61,30 +61,30 @@ jobs:
generate_changelog:
runs-on: ubuntu-latest
steps:
- name: 'Create GitHub App Token'
uses: actions/create-github-app-token@v1
- name: Create GitHub App Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: generate_token
with:
app-id: ${{ inputs.token_app_id }}
private-key: ${{ secrets.token_private_key }}

- name: 'Checkout repository'
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: 'Setup Python'
- name: Setup Python
uses: dfinity/ci-tools/actions/setup-python@main

- name: 'Setup Commitizen'
- name: Setup Commitizen
uses: dfinity/ci-tools/actions/setup-commitizen@main

- name: 'Generate changelog'
- name: Generate changelog
uses: dfinity/ci-tools/actions/generate-changelog@main
with:
file_name: ${{ inputs.file_name }}

- name: 'Create pull request'
- name: Create pull request
uses: dfinity/ci-tools/actions/create-pr@main
with:
branch_name: ${{ inputs.branch_name }}
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/self-check-dist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check Transpiled JavaScript

on:
merge_group:
pull_request:

concurrency:
group: pr-${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
check_dist:
name: check_dist:required
runs-on: ubuntu-latest
strategy:
matrix:
action_name: ['create-pr']
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup PNPM
uses: ./actions/setup-pnpm

- name: Build @dfinity/action-utils
run: pnpm -F @dfinity/action-utils build

- name: Check ${{ matrix.action_name }} dist folder
uses: ./.github/actions/check-dist
with:
action_name: ${{ matrix.action_name }}
23 changes: 23 additions & 0 deletions .github/workflows/self-check-formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check Formatting

on:
merge_group:
pull_request:

concurrency:
group: pr-${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
check_formatting:
name: check_formatting:required
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup PNPM
uses: ./actions/setup-pnpm

- name: Check formatting
run: pnpm run format:check
Loading