Skip to content

Commit d3c42b9

Browse files
authored
Initial Action (#1)
* init * init pt 2 * update node version * mock test * chore: [skip-ci] format code and generate build artifacts * update CODEOWNERS * update codeowners to valid teams * update codeoweners * update codeowners --------- Co-authored-by: Benbentwo <[email protected]>
1 parent 0464a21 commit d3c42b9

File tree

16 files changed

+36445
-1428
lines changed

16 files changed

+36445
-1428
lines changed

.github/CODEOWNERS

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
# Order is important: the last matching pattern has the highest precedence
55

66
# These owners will be the default owners for everything
7-
* @cloudposse/engineering @cloudposse/contributors
7+
* @cloudposse-github-actions/engineering @cloudposse-github-actions/engineering/contributors
88

99
# Cloud Posse must review any changes to Makefiles
10-
**/Makefile @cloudposse/engineering
11-
**/Makefile.* @cloudposse/engineering
10+
**/Makefile @cloudposse-github-actions/engineering
11+
**/Makefile.* @cloudposse-github-actions/engineering
1212

1313
# Cloud Posse must review any changes to GitHub actions
14-
.github/* @cloudposse/engineering
14+
.github/* @cloudposse-github-actions/engineering
1515

1616
# Cloud Posse must review any changes to standard context definition,
1717
# but some changes can be rubber-stamped.
18-
**/*.tf @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
19-
README.yaml @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
20-
README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
21-
docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
18+
**/*.tf @cloudposse-github-actions/engineering @cloudposse-github-actions/contributors
19+
README.yaml @cloudposse-github-actions/engineering @cloudposse-github-actions/contributors
20+
README.md @cloudposse-github-actions/engineering @cloudposse-github-actions/contributors
21+
docs/*.md @cloudposse-github-actions/engineering @cloudposse-github-actions/contributors
2222

2323
# Cloud Posse Admins must review all changes to CODEOWNERS or the mergify configuration
24-
.github/mergify.yml @cloudposse/admins
25-
.github/CODEOWNERS @cloudposse/admins
24+
.github/mergify.yml @cloudposse-github-actions/admins
25+
.github/CODEOWNERS @cloudposse-github-actions/admins

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
- uses: actions/setup-node@v4
1515
with:
16-
node-version: 16
16+
node-version: 20
1717
cache: "yarn"
1818

1919
- name: Install Dependencies

.github/workflows/validate-codeowners.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ jobs:
88
validate-codeowners:
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: "Checkout source code at current commit"
12-
uses: actions/checkout@v4
13-
# Leave pinned at 0.7.1 until https://github.com/mszostok/codeowners-validator/issues/173 is resolved
14-
- uses: mszostok/[email protected]
15-
if: github.event.pull_request.head.repo.full_name == github.repository
16-
name: "Full check of CODEOWNERS"
17-
with:
18-
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
19-
# files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos
20-
# checks: "files,syntax,owners,duppatterns"
21-
checks: "syntax,owners,duppatterns"
22-
owner_checker_allow_unowned_patterns: "false"
23-
# GitHub access token is required only if the `owners` check is enabled
24-
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
25-
- uses: mszostok/[email protected]
26-
if: github.event.pull_request.head.repo.full_name != github.repository
27-
name: "Syntax check of CODEOWNERS"
28-
with:
29-
checks: "syntax,duppatterns"
30-
owner_checker_allow_unowned_patterns: "false"
11+
- name: "Checkout source code at current commit"
12+
uses: actions/checkout@v4
13+
# Leave pinned at 0.7.1 until https://github.com/mszostok/codeowners-validator/issues/173 is resolved
14+
- uses: mszostok/[email protected]
15+
if: github.event.pull_request.head.repo.full_name == github.repository
16+
name: "Full check of CODEOWNERS"
17+
with:
18+
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
19+
# files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos
20+
# checks: "files,syntax,owners,duppatterns"
21+
checks: "syntax,owners,duppatterns"
22+
owner_checker_allow_unowned_patterns: "false"
23+
# GitHub access token is required only if the `owners` check is enabled
24+
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
25+
- uses: mszostok/[email protected]
26+
if: github.event.pull_request.head.repo.full_name != github.repository
27+
name: "Syntax check of CODEOWNERS"
28+
with:
29+
checks: "syntax,duppatterns"
30+
owner_checker_allow_unowned_patterns: "false"

README.yaml

Lines changed: 93 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
#
66

77
# Name of this project
8-
name: github-action-typescript-template
8+
name: Create Branch from a Specific Tag
99

1010
# Tags of this project
1111
tags:
1212
- github-action
1313
- typescript
14-
- template
1514

1615
# Logo for this project
1716
#logo: docs/logo.png
@@ -20,39 +19,113 @@ tags:
2019
license: "APACHE2"
2120

2221
# Canonical GitHub repo
23-
github_repo: cloudposse/github-action-typescript-template
22+
github_repo: cloudposse-github-actions/create-branch-from-tag
2423

2524
# Badges to display
2625
badges:
2726
- name: "Latest Release"
28-
image: "https://img.shields.io/github/release/cloudposse/github-action-typescript-template.svg"
29-
url: "https://github.com/cloudposse/github-action-typescript-template/releases/latest"
27+
image: "https://img.shields.io/github/release/cloudposse-github-actions/create-branch-from-tag.svg"
28+
url: "https://github.com/cloudposse-github-actions/create-branch-from-tag/releases/latest"
3029
- name: "Slack Community"
3130
image: "https://slack.cloudposse.com/badge.svg"
3231
url: "https://slack.cloudposse.com"
3332

3433
related: []
3534

3635
# Short description of this project
37-
description: Template repo for GitHub Actions written in TypeScript
36+
description: This action creates a new branch from a specific tag.
3837

3938
introduction: |-
40-
This repo is a template for GitHub Actions written in TypeScript.
41-
references:
42-
- name: "github-actions-workflows"
43-
description: "Reusable workflows for different types of projects"
44-
url: "https://github.com/cloudposse/github-actions-workflows"
45-
- name: "example-github-action-release-workflow"
46-
description: "Example application with complicated release workflow"
47-
url: "https://github.com/cloudposse/example-github-action-release-workflow"
39+
This action creates a new branch from a specific tag.
40+
41+
This is a fork of [satya-500's create a branch from a tag action](https://github.com/satya-500/create-branch-from-tag)
42+
43+
#references:
44+
# - name: "github-actions-workflows"
45+
# description: "Reusable workflows for different types of projects"
46+
# url: "https://github.com/cloudposse/github-actions-workflows"
47+
# - name: "example-github-action-release-workflow"
48+
# description: "Example application with complicated release workflow"
49+
# url: "https://github.com/cloudposse/example-github-action-release-workflow"
4850

4951
# How to use this project
5052
usage: |
51-
Use this repository as a template in your own GitHub Action project to get started.
5253
53-
include:
54+
create branch from tag
55+
```yaml
56+
- name: creating rc branch
57+
uses: cloudposse-github-actions/[email protected]
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
with:
61+
branch: release
62+
tag: tags/v0.0.7
63+
```
64+
65+
create branch from specific ref (branch)
66+
```yaml
67+
- name: creating rc branch
68+
uses: cloudposse-github-actions/[email protected]
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
with:
72+
branch: release
73+
tag: test
74+
```
5475
55-
# Contributors to this project
56-
contributors:
57-
- name: "Matt Calhoun"
58-
github: "mcalhoun"
76+
Full Job Example (Workflow Dispatch as a shared reusable workflow)
77+
```yaml
78+
on:
79+
workflow_call:
80+
inputs:
81+
runs-on:
82+
description: "The runner labels on which jobs should run on"
83+
required: false
84+
type: string
85+
default: '["self-hosted"]'
86+
organization:
87+
description: "Repository owner organization (e.g. 'acme' for repo acme/example)"
88+
required: true
89+
type: string
90+
repository:
91+
description: "Repository name (e.g. 'example' for repo acme/example)"
92+
required: true
93+
type: string
94+
tag:
95+
description: "The semantic version tag of the release (e.g. 'v1.1.0')"
96+
required: true
97+
type: string
98+
outputs:
99+
branch-name:
100+
description: "Branch name"
101+
value: ${{ jobs.create-branch.outputs.branch-name }}
102+
103+
permissions:
104+
id-token: write
105+
contents: write
106+
107+
jobs:
108+
create-branch:
109+
name: build
110+
runs-on: ${{ fromJSON(inputs.runs-on) }}
111+
steps:
112+
- name: Checkout
113+
uses: actions/checkout@v4
114+
115+
- name: Parse Semver
116+
id: parse-semver
117+
uses: booxmedialtd/ws-action-parse-semver@v1
118+
with:
119+
input_string: ${{ inputs.tag }}
120+
121+
- name: Create Release Branch
122+
uses: cloudposse-github-actions/create-branch-from-tag@main
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
with:
126+
# The following can easily just be 'release/${{ inputs.tag }}', however it is left as is
127+
# in case the tag needs to be manipulated. For example:
128+
# 'release/${{ steps.parse-semver.outputs.major }}.${{ steps.parse-semver.outputs.minor }}.x'
129+
branch: release/${{ steps.parse-semver.outputs.fullversion }}
130+
from: tags/${{ inputs.tag }}
131+
```

action.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
name: "github-actions-typescript-template"
2-
description: "A template for creating GitHub Actions in TypeScript"
1+
name: 'Create Branch From a Specific Tag'
2+
description: 'Create Branch From Specific Tag'
33
author: "Cloud Posse"
4+
45
inputs:
5-
milliseconds:
6+
branch:
7+
description: 'The branch to create'
8+
default: 'release'
9+
from:
10+
description: 'Provide the tag number ex:- v0.0.7 or branch name i.e develop'
611
required: true
7-
description: "input description here"
8-
default: "200"
12+
913
runs:
1014
using: "node20"
1115
main: "dist/index.js"
16+
branding:
17+
icon: 'git-branch'
18+
color: 'black'

0 commit comments

Comments
 (0)