Skip to content

Commit 8186c59

Browse files
committed
chore: add CI workflow, release workflow, and project documentation
- Add CI workflow with actionlint and action.yml validation - Add release workflow for retagging major versions - Include CODE_OF_CONDUCT.md, CONTRIBUTING.md, LICENSE, and SECURITY.md - Add README with installation examples and configuration options - Include example branch protection settings and workflow configurations Signed-off-by: igorjs <oss@mail.igorjs.io>
0 parents  commit 8186c59

File tree

11 files changed

+624
-0
lines changed

11 files changed

+624
-0
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main, master]
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v5
12+
- name: actionlint
13+
uses: rhysd/actionlint@v1
14+
- name: Validate action.yml
15+
run: |
16+
test -f action.yml || (echo "action.yml missing" && exit 1)
17+
grep -q "runs:" action.yml

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [published]
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
retag-major:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
with:
15+
fetch-depth: 0
16+
- name: Move major tag (v1 → latest)
17+
env:
18+
TAG_REF: ${{ github.ref_name }} # e.g. v1.3.0
19+
run: |
20+
set -euo pipefail
21+
git config user.name "release[bot]"
22+
git config user.email "release[bot]@users.noreply.github.com"
23+
[[ "$TAG_REF" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Not a semver tag"; exit 1; }
24+
MAJOR="${TAG_REF%%.*}" # v1
25+
git tag -f "$MAJOR" "$TAG_REF"
26+
git push -f origin "$MAJOR"

CODE_OF_CONDUCT.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment‑free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio‑economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation【426605577719396†L4-L13】. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
6+
7+
## Our Standards
8+
9+
Examples of behaviour that contributes to a positive environment include demonstrating empathy and kindness toward other people, being respectful of differing opinions, viewpoints, and experiences, giving and gracefully accepting constructive feedback, apologising to those affected by mistakes and learning from the experience, and focusing on what is best for the overall community【771408749191128†L16-L25】.
10+
11+
Examples of unacceptable behaviour include the use of sexualised language or imagery, trolling, insulting or derogatory comments, personal or political attacks, public or private harassment, publishing others’ private information, and other conduct which could reasonably be considered inappropriate in a professional setting【771408749191128†L27-L37】.
12+
13+
## Enforcement Responsibilities
14+
15+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behaviour. They have the right to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate【771408749191128†L39-L49】.
16+
17+
## Scope
18+
19+
This Code of Conduct applies within all community spaces and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event【771408749191128†L51-L58】.
20+
21+
## Enforcement
22+
23+
Instances of abusive, harassing, or otherwise unacceptable behaviour may be reported to the maintainers at **[INSERT CONTACT METHOD]**. All complaints will be reviewed and investigated promptly and fairly【771408749191128†L59-L66】. The maintainers are obligated to respect the privacy and security of the reporter of any incident.
24+
25+
Enforcement follows these community impact guidelines:
26+
27+
1. **Correction** – A private, written warning and request for apology for a first violation【771408749191128†L74-L82】.
28+
2. **Warning** – A warning with consequences for continued behaviour and a specified period of no interaction with those enforcing the Code【771408749191128†L83-L93】.
29+
3. **Temporary Ban** – A temporary ban from public interaction for serious violations【771408749191128†L95-L103】.
30+
4. **Permanent Ban** – A permanent ban from the community for sustained or extreme violations【771408749191128†L106-L113】.
31+
32+
## Attribution
33+
34+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1【771408749191128†L116-L119】, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing
2+
3+
Thank you for considering contributing to this project! The merge queue action is maintained by volunteers, and contributions of all kinds are welcome.
4+
5+
## Getting Started
6+
7+
1. **Fork** this repository and create a branch for your feature or bug fix. Use a descriptive branch name (for example, `feature/fastlane-optimisation`).
8+
2. **Discuss** your proposed change by opening an issue. This helps avoid duplication and ensures your work aligns with project goals.
9+
3. **Develop** your change. Write clear commit messages and add tests where appropriate.
10+
4. **Submit a pull request (PR).** Describe your changes and reference the issue you’re addressing. PRs will be queued and merged by the action once approved.
11+
5. **Keep your PR up to date.** If your branch falls far behind the base, the action can auto‑update it if configured; otherwise please rebase or merge from the base branch.
12+
13+
## Code of Conduct
14+
15+
This project and all contributors are expected to abide by our Code of Conduct. It outlines behaviours that contribute to a positive environment and those that are unacceptable【426605577719396†L16-L39】. Instances of abusive or harassing behaviour may be reported to the maintainers.
16+
17+
## Support
18+
19+
For general questions or suggestions that are not feature requests or bug reports, you can open a discussion in the repository or contact the maintainers directly.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 igorjs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the “Software”), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software【16404071374199†L4-L16】.
14+
15+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE【16404071374199†L14-L19】.

README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Merge Queue GitHub Action
2+
3+
This repository provides a GitHub composite action that implements a **merge queue** with an optional hot‑fix fastlane. The queue is FIFO (first‑in, first‑out) and works on GitHub Free and private repositories. Merges are staged on a temporary branch before reaching your protected branch, ensuring that only tested code lands on `master`/`main`.
4+
5+
## Features
6+
7+
* **FIFO merge queue** – Pull requests are merged in the order they were approved.
8+
* **Hot‑fix fastlane** – Pull requests whose branch name or title matches a configurable regex (for example `hotfix/`) bypass the queue.
9+
* **Auto‑update of stale branches** – Optionally update PR branches that have fallen behind your base by a specified number of commits.
10+
* **Shadow vs. live mode** – Shadow mode tests your configuration without merging; live mode performs actual merges.
11+
* **No additional services required** – Uses the built‑in `GITHUB_TOKEN` only; no enterprise features or external CI are required.
12+
13+
## Installation
14+
15+
Add the action to your workflow by referencing the tag in your repository. Make sure your repository’s **Settings → Branch protection** requires the custom status set in `status_context` (default `merge‑queue`) and disables **“Require branches to be up to date with base”**.
16+
17+
### Example: shadow mode
18+
19+
```yaml
20+
name: Merge Queue (shadow)
21+
on:
22+
pull_request:
23+
types: [opened, reopened, ready_for_review, synchronize, converted_to_draft, review_requested]
24+
schedule:
25+
- cron: "*/5 * * * *"
26+
workflow_dispatch: {}
27+
28+
permissions:
29+
contents: write
30+
pull-requests: write
31+
statuses: write
32+
33+
concurrency:
34+
group: merge-queue
35+
cancel-in-progress: true
36+
37+
jobs:
38+
queue:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: igorjs/gh-actions-merge-queue@v1
42+
with:
43+
base_branch: main
44+
mode: shadow
45+
merge_method: merge
46+
status_context: merge-queue
47+
behind_max_commits: "100"
48+
fastlane_matchers: "^(hotfix|critical|security)/,\\bhotfix\\b,^hotfix:"
49+
```
50+
51+
### Example: live mode
52+
53+
To enable real merges, flip `mode` to `live` and adjust your branch protection accordingly.
54+
55+
```yaml
56+
- uses: igorjs/gh-actions-merge-queue@v1
57+
with:
58+
base_branch: main
59+
mode: live
60+
merge_method: merge
61+
status_context: merge-queue
62+
behind_max_commits: "100"
63+
```
64+
65+
## Inputs
66+
67+
This action exposes a number of inputs to customise behaviour:
68+
69+
* **token** – Optional, defaults to `GITHUB_TOKEN`.
70+
* **base_branch** – Base branch to merge into (default `master`).
71+
* **queue_branch** – Temporary branch used to stage the merge (default `merge‑queue/staging`).
72+
* **fastlane_branch** – Temporary branch for fastlane merges (default `merge‑queue/fastlane`).
73+
* **state_branch** – Branch that stores the FIFO queue file (default `merge‑queue/state`).
74+
* **queue_file** – Path to the queue JSON file inside the state branch (default `.github/merge‑queue‑queue.json`).
75+
* **status_context** – Commit status context; must be required in branch protection (default `merge‑queue`).
76+
* **mode** – `shadow` or `live` (default `shadow`).
77+
* **fastlane_matchers** – Comma‑separated regex patterns used to detect fastlane PRs.
78+
* **behind_max_commits** – Update PR branches if behind more than this number of commits (0 disables).
79+
* **merge_method** – `merge` (preserves the tested tree) or `squash`.
80+
* **clean_queue** – Whether to delete the temporary queue branches (default `true`).
81+
82+
## Branch protection
83+
84+
1. Protect your base branch (`master` or `main`).
85+
2. Require pull request reviews as you normally do.
86+
3. Add the status context specified in your workflow (default `merge‑queue`) as the only required status check.
87+
4. Turn **off** “Require branches to be up to date before merging.”
88+
5. Allow **merge commits** (recommended) or configure your merge method to squash.
89+
90+
For more information on branch protection and security policies, see the GitHub documentation【162389469722289†L471-L485】.
91+
92+
## License
93+
94+
This project is licensed under the MIT License. The MIT License allows free use, modification, and distribution of the software, provided that the copyright notice and license text appear in all copies and substantial portions of the software【16404071374199†L4-L16】.
95+
96+
## Code of Conduct
97+
98+
Participation in this project is governed by a Code of Conduct that aims to create a welcoming and inclusive environment. The code is adapted from the Contributor Covenant v2.1 and outlines behaviours that foster a positive community and those that are unacceptable【426605577719396†L4-L27】. Please review it in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
99+
100+
## Security
101+
102+
To report a security vulnerability, please see [`SECURITY.md`](SECURITY.md) for instructions on responsible disclosure.

SECURITY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Only the **v1** series of the merge queue action is currently supported. When a new major version is released, support for previous major versions will end one year after release.
6+
7+
## Reporting a Vulnerability
8+
9+
If you believe you have found a security vulnerability, please report it responsibly. You can either:
10+
11+
* Email the maintainers at **oss@mail.igorjs.io**, or
12+
* Use GitHub’s **Report a vulnerability** feature to open a private security advisory.
13+
14+
Please do not disclose security issues publicly until we have had a chance to review and fix them. We commit to respond within three business days and will work with you to coordinate disclosure and a fix. GitHub recommends linking to your security policy from your README【162389469722289†L471-L485】; doing so helps reporters find the correct procedure quickly.
15+
16+
Thank you for helping to keep this project secure.

0 commit comments

Comments
 (0)