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
78 changes: 78 additions & 0 deletions .github/workflows/ci-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI and Release

on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
push:
branches: [main]
workflow_dispatch:

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

permissions:
contents: write

jobs:
test-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check version tag does not exist
run: |
VERSION=$(node -p "require('./package.json').version")
if git ls-remote --tags origin | grep -q "refs/tags/v${VERSION}$"; then
echo "::error::Tag v${VERSION} already exists. Bump version in package.json first."
exit 1
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Create version tags
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
VERSION="${{ env.VERSION }}"
MAJOR=$(echo "$VERSION" | cut -d. -f1)

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

git tag "v${VERSION}"
git tag -f "v${MAJOR}"
git push origin "v${VERSION}" "+v${MAJOR}"

- name: Write job summary
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
VERSION="${{ env.VERSION }}"
MAJOR=$(echo "$VERSION" | cut -d. -f1)
SHA="${{ github.sha }}"

cat >> $GITHUB_STEP_SUMMARY << EOF
## Release Summary

| Item | Value |
|--------------|----------------------------------|
| Version | \`${VERSION}\` |
| Commit | \`${SHA:0:7}\` |
| Tags Created | \`v${VERSION}\`, \`v${MAJOR}\` |

Users can reference this action as:
- \`uses: boldtrail/pr-integration-action@v${VERSION}\` - exact version
- \`uses: boldtrail/pr-integration-action@v${MAJOR}\` - latest v${MAJOR}.x.x
EOF
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ A GitHub Action that automatically integrates approved Pull Requests into a stag

- **Run locally:** `npm start` (runs `node src/main.js`, requires GitHub Action environment variables)
- **Install dependencies:** `npm install`
- **Run tests:** `npm test` (vitest, tests in `test/`)
- **Manual test:** Trigger via GitHub Actions workflow dispatch (`.github/workflows/test_workflow.yml`)
- No test suite, linter, or build step is configured.
- No linter or build step is configured.

## Architecture

Expand Down Expand Up @@ -61,7 +62,7 @@ Inputs: `repository`, `github_token`, `token_with_workflow_scope`, `master_branc

Output: `haveUpdates` — "yes" or "no"

Runtime: node16 (per action.yml)
Runtime: node20 (per action.yml)


## Formatting
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ outputs:
description: Indicates whether any new or updated PRs were integrated. Values 'yes', 'no'

runs:
using: 'node16'
using: 'node20'
main: 'entrypoint.js'
Loading