Skip to content

Commit

Permalink
ci(.github/action): add deploy-release github action (#157)
Browse files Browse the repository at this point in the history
* ci(.github/action): add deploy-release github action

* ci(.github/action): rename the deploy-release action to move-released-issues-and-create-sync-pr. Add a default value of the input pr-team-reviewers

* ci(.github/action): change a step to get a previous tag in the move-released-issues-and-create-sync-pr action

* ci(.github/action): remove checkout step in the move-released-issues-and-create-sync-pr action

* ci(.github/action): change README.md of the move-released-issues-and-create-sync-pr action
  • Loading branch information
maksym-shynkarenko authored Apr 17, 2024
1 parent 19356cc commit 2fb4a2a
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# move-released-issues-and-create-sync-pr-v1

A GitHub Action to label all related issues with the package version and create a PR to sync branches

## Inputs

| Name | Required | Description | Default |
| ------------------- | -------- | -------------------------------------------- | ------------ |
| `token` | Yes | A GitHub token with the required permissions | NA |
| `project-number` | No | A project number of the project board | 66 |
| `head` | No | A head branch to sync from | main |
| `base` | No | A target branch for the created pull request | develop |
| `pr-team-reviewers` | No | Reviewers to tag on the created pull request | axe-api-team |

## Example usage

```yaml
name: Deploy release

jobs:
move-released-issues-and-create-sync-pr:
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
- uses: actions/checkout@v4
with:
# Fetch all history
fetch-depth: 0
- uses: dequelabs/axe-api-team-public/.github/actions/move-released-issues-and-create-sync-pr-v1@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
project-number: '66'
head: main
base: develop
pr-team-reviewers: axe-api-team
env:
# Required for the GH CLI
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
## Permissions
This action requires the following permission scopes:
- `repository-projects: read` - To move issues into a project
- `issues: write` - To add a label into an issue
- `contents: read` - To work with the contents of the repository
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: move-released-issues-and-create-sync-pr-v1
description: Label all related issues with the package version and create a PR to sync branches

inputs:
token:
description: 'A GitHub token with the required permissions'
required: true
project-number:
description: 'A project number of the project board'
required: false
default: '66'
head:
description: 'A head branch to sync from'
required: false
default: main
base:
description: 'A target branch for the created pull request'
required: false
default: develop
pr-team-reviewers:
description: 'Reviewers to tag on the created pull request'
required: false
default: axe-api-team

runs:
using: 'composite'
steps:
- name: Get the previous tag prior to the latest
id: get-previous-tag
shell: bash
run: |
TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))
# Remove "v" prefix
TAG_VERSION=${TAG#v}
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "tag-version=$TAG_VERSION" >> $GITHUB_OUTPUT
- uses: dequelabs/maksym-testing/.github/actions/generate-commit-list-v1@develop
id: get-commit-list
with:
tag: ${{ steps.get-previous-tag.outputs.tag }}
- uses: dequelabs/axe-api-team-public/.github/actions/label-and-move-released-issues-v1@main
with:
commit-list: ${{ steps.get-commit-list.outputs.commit-list }}
version: ${{ steps.get-previous-tag.outputs.tag-version }}
token: ${{ inputs.token }}
project-number: ${{ inputs.project-number }}
- uses: dequelabs/action-sync-branches@master
with:
github-token: ${{ inputs.token }}
pr-title: 'chore: merge ${{ inputs.head }} into ${{ inputs.base }}'
pr-body: 'Remember to _merge_ (rather than squash) this PR! Also, auto-merge does not work because many of the required checks do not run on the `${{ inputs.head }}` branch.'
pr-team-reviewers: ${{ inputs.pr-team-reviewers }}
head: ${{ inputs.head }}
base: ${{ inputs.base }}

0 comments on commit 2fb4a2a

Please sign in to comment.