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

feat(create-prs-to-update-vcs-repositories): new github action #317

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d6a03d2
feat(create_prs_for_vcs_repositories_update): add initial files
sasakisasaki Sep 4, 2024
87c0525
renamed from create_prs_for_vcs_repositories_update to create-prs-for…
sasakisasaki Sep 4, 2024
e931b59
fix(create-prs-for-vcs-repositories-update): fix a wrong branch name …
sasakisasaki Sep 4, 2024
f7abebe
fix(create_prs_for_vcs_repositories_update): add missing shell property
sasakisasaki Sep 4, 2024
144e1cd
fix(create_prs_for_vcs_repositories_update): bug fix in missing using…
sasakisasaki Sep 4, 2024
c18a9ba
fix(create_prs_for_vcs_repositories_update): bug fix for missing back…
sasakisasaki Sep 4, 2024
21f185b
doc(create-prs-for-vcs-repositories-update): fix missing description …
sasakisasaki Sep 4, 2024
da19467
doc(create-prs-for-vcs-repositories-update): fix temporary names
sasakisasaki Sep 4, 2024
e959332
style(pre-commit): autofix
pre-commit-ci[bot] Sep 4, 2024
c7b73c0
fix(create-prs-for-vcs-repositories-update): fix yamllint errors
sasakisasaki Sep 4, 2024
ccdf724
Merge branch 'add-feature-for-creating-prs-which-update-vcs-repositor…
sasakisasaki Sep 4, 2024
ed9a6e4
fix(create-prs-for-vcs-repositories-update): Avoid cspell check fail …
sasakisasaki Sep 4, 2024
cb0e725
fix(create-prs-for-vcs-repositories-update): fix wrong comments
sasakisasaki Sep 4, 2024
b36d0f7
fix(create-prs-for-vcs-repositories-update): use "-" not "_"
sasakisasaki Sep 5, 2024
74ed788
fix(create-prs-for-vcs-repositories-update): renamed as follows excep…
sasakisasaki Sep 5, 2024
e9b9354
fix(create-prs-to-update-vcs-repositories): renamed folder as follows
sasakisasaki Sep 5, 2024
dd45fd1
fix(create-prs-to-update-vcs-repositories): rename a function to be c…
sasakisasaki Sep 5, 2024
41d89e0
fix(create-prs-to-update-vcs-repositories): do not declare logger out…
sasakisasaki Sep 5, 2024
f7546c6
fix(create-prs-to-update-vcs-repositories): parse args inside of used…
sasakisasaki Sep 5, 2024
4c82d6a
fix(create-prs-to-update-vcs-repositories): typos
sasakisasaki Sep 5, 2024
03c3e34
Merge branch 'main' into add-feature-for-creating-prs-which-update-vc…
sasakisasaki Sep 5, 2024
6353a85
Merge branch 'main' into add-feature-for-creating-prs-which-update-vc…
sasakisasaki Sep 6, 2024
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
60 changes: 60 additions & 0 deletions create-prs-to-update-vcs-repositories/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# create-prs-to-update-vcs-repositories

## Description

This action creates pull requests to update the vcs repositories in the autoware repository.

## Initial setup (within `autowarefoundation` org)

This action uses the <https://github.com/apps/awf-autoware-bot> app to create pull requests.

### Secrets

For this action to use this bot, it requires the following secrets:

- `APP_ID`: The app ID of the bot.
- `PRIVATE_KEY`: The private key of the bot.

These secrets are already set if inside of the autoware repository.

## Usage

```yaml
jobs:
sync-files:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Run
uses: autowarefoundation/autoware-github-actions/create-prs-to-update-vcs-repositories@v1
with:
token: ${{ steps.generate-token.outputs.token }}
repo_name: autowarefoundation/autoware
parent_dir: .
base_branch: main
new_branch_prefix: feat/update-
autoware_repos_file_name: autoware.repos
verbosity: 0
```

## Inputs

| Name | Required | Default | Description |
| ------------------------ | -------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| token | true | | The token for pull requests. |
| repo_name | true | | The name of the repository to create pull requests. |
| parent_dir | false | . | The parent directory of the repository. |
| base_branch | false | main | The base branch to create pull requests. |
| new_branch_prefix | false | feat/update- | The prefix of the new branch name. The branch name will be `{new_branch_prefix}-{user_name}/{repository_name}/{new_version}`. |
| autoware_repos_file_name | false | autoware.repos | The name of the vcs imported repository's file (e.g. autoware.repos). |
| verbosity | false | 0 | The verbosity level (0 - 2). |

## Outputs

None.
69 changes: 69 additions & 0 deletions create-prs-to-update-vcs-repositories/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: create-prs-to-update-vcs-repositories
description: Create PRs to update VCS repositories

inputs:
token:
description: GitHub token
required: true
repo_name:
description: Repository name
required: true
parent_dir:
description: Parent directory
required: false
default: ./
base_branch:
description: Base branch
required: false
default: main
new_branch_prefix:
description: New branch prefix. The branch name will be "<new_branch_prefix>-<user_name>/<repository_name>/<new_version>".
required: false
default: feat/update-
autoware_repos_file_name:
description: Autoware repositories file name
required: false
default: autoware.repos
verbosity:
description: Verbosity level
required: false
default: 0

runs:
using: composite
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
architecture: x64

- name: Install dependencies
shell: bash
run: python -m pip install --upgrade ruamel.yaml PyGithub GitPython packaging

- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ inputs.token }}

- name: Fetch all branches
shell: bash
run: git fetch --all

- name: Run Python
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
run: |
VERBOSITY=""
for i in $(seq 1 ${{ inputs.verbosity }}); do
VERBOSITY="$VERBOSITY -v"
done
python ${GITHUB_ACTION_PATH}/create_prs_to_update_vcs_repositories.py \
--repo_name ${{ inputs.repo_name }} \
--parent_dir ${{ inputs.parent_dir }} \
--base_branch ${{ inputs.base_branch }} \
--new_branch_prefix ${{ inputs.new_branch_prefix }} \
--autoware_repos_file_name ${{ inputs.autoware_repos_file_name }} \
$VERBOSITY
Loading
Loading