Compare commits

..

No commits in common. "main" and "v6.4" have entirely different histories.
main ... v6.4

18 changed files with 736 additions and 1674 deletions

View File

@ -13,24 +13,6 @@
"contributions": [
"code"
]
},
{
"login": "IanWoodard",
"name": "Ian Woodard",
"avatar_url": "https://avatars.githubusercontent.com/u/17186604?v=4",
"profile": "https://ianwoodard.me",
"contributions": [
"doc"
]
},
{
"login": "boidolr",
"name": "Raphael Boidol",
"avatar_url": "https://avatars.githubusercontent.com/u/652404?v=4",
"profile": "https://home.boidol.dev/",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,
@ -38,7 +20,5 @@
"projectOwner": "tj-actions",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true,
"commitType": "docs",
"commitConvention": "angular"
"skipCi": true
}

12
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: jackton1
patreon: # Replace with a single Patreon username
open_collective: tj-actions
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: []

97
.github/ISSUE_TEMPLATE/bug_report.yaml vendored Normal file
View File

@ -0,0 +1,97 @@
name: 🐞 Bug
description: Create a report to help us improve
title: "[BUG] <title>"
labels: [bug, needs triage]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
attributes:
label: Does this issue exist in the latest version?
description: Please view all releases to confirm that this issue hasn't already been fixed.
options:
- label: I'm using the latest release
required: true
- type: textarea
id: what-happened
attributes:
label: Describe the bug?
description: A clear and concise description of what the bug is
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: To Reproduce
description: Steps to reproduce the behavior?
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: dropdown
id: os
attributes:
label: What OS are you seeing the problem on?
multiple: true
options:
- all
- ubuntu-latest or ubuntu-20.04
- ubuntu-18.04
- macos-latest or macos-10.15
- macos-11
- windows-latest or windows-2019
- windows-2016
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior?
description: A clear and concise description of what you expected to happen.
placeholder: Tell us what you expected!
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
placeholder: |
This can be achieved by:
1. Re-running the workflow with debug logging enabled.
2. Copy or download the log archive.
3. Paste the contents here or upload the file in a subsequent comment.
render: shell
- type: textarea
attributes:
label: Anything else?
description: |
Links? or References?
Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](../blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true

View File

@ -0,0 +1,59 @@
name: Feature request
description: Suggest an idea for this project
title: "[Feature] <title>"
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: checkboxes
attributes:
label: Is this feature missing in the latest version?
description: Please upgrade to the latest version to verify that this feature is still missing.
options:
- label: I'm using the latest release
required: true
- type: textarea
id: what-happened
attributes:
label: Is your feature request related to a problem? Please describe.
description: |
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: requests
attributes:
label: Describe the solution you'd like?
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: alternative
attributes:
label: Describe alternatives you've considered?
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? or References?
Add any other context or screenshots about the feature request here.
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](../blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true

View File

@ -5,5 +5,3 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- "merge when passing"

32
.github/workflows/auto-approve.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Auto approve
on:
pull_request_target
jobs:
auto-approve:
runs-on: ubuntu-latest
steps:
- uses: hmarr/auto-approve-action@v3
if: |
(
github.event.pull_request.user.login == 'dependabot[bot]' ||
github.event.pull_request.user.login == 'dependabot' ||
github.event.pull_request.user.login == 'dependabot-preview[bot]' ||
github.event.pull_request.user.login == 'dependabot-preview' ||
github.event.pull_request.user.login == 'renovate[bot]' ||
github.event.pull_request.user.login == 'renovate' ||
github.event.pull_request.user.login == 'github-actions[bot]'
)
&&
(
github.actor == 'dependabot[bot]' ||
github.actor == 'dependabot' ||
github.actor == 'dependabot-preview[bot]' ||
github.actor == 'dependabot-preview' ||
github.actor == 'renovate[bot]' ||
github.actor == 'renovate' ||
github.actor == 'github-actions[bot]'
)
with:
github-token: ${{ secrets.PAT_TOKEN }}

26
.github/workflows/auto-merge.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: automerge
on:
check_suite:
types:
- completed
jobs:
automerge:
runs-on: ubuntu-latest
if: |
github.actor == 'dependabot[bot]' ||
github.actor == 'dependabot' ||
github.actor == 'dependabot-preview[bot]' ||
github.actor == 'dependabot-preview' ||
github.actor == 'renovate[bot]' ||
github.actor == 'renovate'
steps:
- name: automerge
uses: pascalgn/automerge-action@v0.15.5
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
MERGE_METHOD: "rebase"
UPDATE_METHOD: "rebase"
MERGE_RETRIES: "6"
MERGE_RETRY_SLEEP: "100000"
MERGE_LABELS: ""

View File

@ -29,12 +29,12 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
uses: actions/checkout@v3
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
continue-on-error: true
uses: codacy/codacy-analysis-cli-action@v4.4.5
uses: codacy/codacy-analysis-cli-action@v4.2.0
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
@ -51,6 +51,6 @@ jobs:
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
continue-on-error: true
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif

13
.github/workflows/greetings.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Greetings
on: [pull_request_target, issues]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience."
pr-message: "Thanks for implementing a fix, could you ensure that the test covers your changes if applicable."

View File

@ -8,7 +8,7 @@ jobs:
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@v3.2.0
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

View File

@ -8,11 +8,11 @@ jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run release-tagger
uses: tj-actions/release-tagger@v4
uses: tj-actions/release-tagger@v2
- name: Sync release version.
uses: tj-actions/sync-release-version@v13
id: sync-release-version
@ -21,10 +21,12 @@ jobs:
only_major: true
paths: |
README.md
- name: Run git-cliff
uses: tj-actions/git-cliff@v1
- name: Generate CHANGELOG
uses: tj-actions/github-changelog-generator@v1.15
with:
output: 'HISTORY.md'
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@v4.2.3
with:
base: "main"
labels: "merge when passing"

View File

@ -6,83 +6,82 @@ on:
- '*'
branches:
- main
release:
types: [published, created]
pull_request_target:
pull_request:
branches:
- main
jobs:
test:
name: Test branch-names
name: Test branch-name
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, windows-2022]
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@v3.2.0
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Run test
id: branch-names
id: branch-name
uses: ./
- name: Show output
run: |
echo "Default Branch: ${{ steps.branch-names.outputs.default_branch }}"
echo "Current Branch: ${{ steps.branch-names.outputs.current_branch }}"
echo "Base Ref: ${{ steps.branch-names.outputs.base_ref_branch }}"
echo "Head Ref: ${{ steps.branch-names.outputs.head_ref_branch }}"
echo "Ref: ${{ steps.branch-names.outputs.ref_branch }}"
echo "Is Default: ${{ steps.branch-names.outputs.is_default }}"
echo "Is Tag: ${{ steps.branch-names.outputs.is_tag }}"
echo "Current tag: ${{ steps.branch-names.outputs.tag }}"
echo "Default Branch: ${{ steps.branch-name.outputs.default_branch }}"
echo "Current Branch: ${{ steps.branch-name.outputs.current_branch }}"
echo "Base Ref: ${{ steps.branch-name.outputs.base_ref_branch }}"
echo "Head Ref: ${{ steps.branch-name.outputs.head_ref_branch }}"
echo "Ref: ${{ steps.branch-name.outputs.ref_branch }}"
echo "Is Default: ${{ steps.branch-name.outputs.is_default }}"
echo "Is Tag: ${{ steps.branch-name.outputs.is_tag }}"
echo "Current tag: ${{ steps.branch-name.outputs.tag }}"
- name: Test is_default output for pull request
if: contains(github.event_name, 'pull_request') && steps.branch-names.outputs.is_tag == 'false' && steps.branch-names.outputs.is_default != 'false'
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default != 'false'
run: |
echo "Is default is invalid: ${{ steps.branch-names.outputs.is_default }}"
echo "Is default is invalid: ${{ steps.branch-name.outputs.is_default }}"
exit 1
- name: Test is_default output for non pull request
if: "!contains(github.event_name, 'pull_request') && steps.branch-names.outputs.is_tag == 'false' && steps.branch-names.outputs.is_default != 'true'"
if: github.event_name != 'pull_request' && github.event_name != 'pull_request_target' && steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default != 'true'
run: |
echo "Is default is invalid: ${{ steps.branch-names.outputs.is_default }}"
echo "Is default is invalid: ${{ steps.branch-name.outputs.is_default }}"
exit 1
- name: Test base_ref_branch output
if: contains(github.event_name, 'pull_request') && steps.branch-names.outputs.is_tag == 'false' && !steps.branch-names.outputs.base_ref_branch
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && steps.branch-name.outputs.is_tag == 'false' && !steps.branch-name.outputs.base_ref_branch
run: |
echo "Base ref unset: ${{ steps.branch-names.outputs.base_ref_branch }}"
echo "Base ref unset: ${{ steps.branch-name.outputs.base_ref_branch }}"
exit 1
- name: Test head_ref output
if: contains(github.event_name, 'pull_request') && steps.branch-names.outputs.is_tag == 'false' && !steps.branch-names.outputs.head_ref_branch
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && steps.branch-name.outputs.is_tag == 'false' && !steps.branch-name.outputs.head_ref_branch
run: |
echo "Head ref unset: ${{ steps.branch-names.outputs.head_ref_branch }}"
echo "Head ref unset: ${{ steps.branch-name.outputs.head_ref_branch }}"
exit 1
- name: Test ref_branch output
if: "!steps.branch-names.outputs.ref_branch && steps.branch-names.outputs.is_tag == 'false'"
if: "!steps.branch-name.outputs.ref_branch && steps.branch-name.outputs.is_tag == 'false'"
run: |
echo "Ref unset: ${{ steps.branch-names.outputs.ref_branch }}"
echo "Ref unset: ${{ steps.branch-name.outputs.ref_branch }}"
exit 1
- name: Test current_branch output for pull_request or pull_request_target event.
if: contains(github.event_name, 'pull_request') && steps.branch-names.outputs.is_tag == 'false' && !steps.branch-names.outputs.current_branch
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && steps.branch-name.outputs.is_tag == 'false' && !steps.branch-name.outputs.current_branch
run: |
echo "Current branch unset: ${{ steps.branch-names.outputs.current_branch }}"
echo "Current branch unset: ${{ steps.branch-name.outputs.current_branch }}"
exit 1
- name: Test current_branch output for push event.
if: github.event_name == 'push' && steps.branch-names.outputs.is_tag == 'false' && !steps.branch-names.outputs.current_branch
if: github.event_name == 'push' && steps.branch-name.outputs.is_tag == 'false' && !steps.branch-name.outputs.current_branch
run: |
echo "Current branch unset: ${{ steps.branch-names.outputs.current_branch }}"
echo "Current branch unset: ${{ steps.branch-name.outputs.current_branch }}"
exit 1
- name: Test current_branch output for tag based push event.
if: github.event_name == 'push' && steps.branch-names.outputs.is_tag == 'true' && !steps.branch-names.outputs.base_ref_branch
if: github.event_name == 'push' && steps.branch-name.outputs.is_tag == 'true' && !steps.branch-name.outputs.base_ref_branch
run: |
echo "Base ref unset: ${{ steps.branch-names.outputs.base_ref_branch }}"
echo "Base ref unset: ${{ steps.branch-name.outputs.base_ref_branch }}"
exit 1
- name: Test tag output for tag based push event.
if: github.event_name == 'push' && steps.branch-names.outputs.is_tag == 'true' && !steps.branch-names.outputs.tag
if: github.event_name == 'push' && steps.branch-name.outputs.is_tag == 'true' && !steps.branch-name.outputs.tag
run: |
echo "Current tag unset: ${{ steps.branch-names.outputs.tag }}"
echo "Current tag unset: ${{ steps.branch-name.outputs.tag }}"
exit 1

View File

@ -9,38 +9,34 @@ jobs:
sync-assets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@v3.2.0
with:
fetch-depth: 0
- name: Run auto-doc
uses: tj-actions/auto-doc@v3
uses: tj-actions/auto-doc@v1.6.0
with:
use_code_blocks: true
use_major_version: true
col_max_words: 7
- name: Run remark
- name: Run test
uses: tj-actions/remark@v3
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v20
uses: tj-actions/verify-changed-files@v13
id: verify_changed_files
with:
files: |
README.md
- name: README.md changed
if: steps.verify_changed_files.outputs.files_changed == 'true'
run: |
echo "README.md has uncommitted changes"
echo "README.md has uncommited changes"
exit 1
- name: Create Pull Request
if: failure()
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@v4
with:
base: "main"
labels: "merge when passing"
title: "Updated README.md"
branch: "chore/update-readme"
commit-message: "Updated README.md"

1665
HISTORY.md

File diff suppressed because it is too large Load Diff

211
README.md
View File

@ -1,37 +1,21 @@
## branch-names
[![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge\&logo=ubuntu\&logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
[![Mac OS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge\&logo=macos\&logoColor=F0F0F0)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
[![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge\&logo=windows\&logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
[![Public workflows that use this action.](https://img.shields.io/endpoint?style=for-the-badge\&url=https%3A%2F%2Fused-by.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Dtj-actions%2Fbranch-names%26badge%3Dtrue%26package_id%3DUGFja2FnZS0yOTQyNTYxMTIz)](https://github.com/search?o=desc\&q=tj-actions+branch-names+language%3AYAML\&s=\&type=Code)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4df2ae51586b43f1bfd26e1aedc69965)](https://app.codacy.com/gh/tj-actions/branch-names/dashboard?utm_source=gh\&utm_medium=referral\&utm_content=\&utm_campaign=Badge_grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/36f9e8c5e9664e0bacc7df558c13f349)](https://app.codacy.com/gh/tj-actions/branch-names?utm_source=github.com\&utm_medium=referral\&utm_content=tj-actions/branch-names\&utm_campaign=Badge_Grade_Settings)
[![CI](https://github.com/tj-actions/branch-names/workflows/CI/badge.svg)](https://github.com/tj-actions/branch-names/actions?query=workflow%3ACI)
[![Update release version.](https://github.com/tj-actions/branch-names/actions/workflows/sync-release-version.yml/badge.svg)](https://github.com/tj-actions/branch-names/actions/workflows/sync-release-version.yml)
[![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fused-by.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Dtj-actions%2Fbranch-names%26badge%3Dtrue)](https://github.com/search?o=desc\&q=tj-actions+branch-names+language%3AYAML\&s=\&type=Code)
[![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu\&logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
[![Mac OS](https://img.shields.io/badge/mac%20os-000000?logo=macos\&logoColor=F0F0F0)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
[![Windows](https://img.shields.io/badge/Windows-0078D6?logo=windows\&logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
Get a branch or tag name without the `/ref/*` prefix.
## Table of Contents
* [Features](#features)
* [Usage](#usage)
* [Inputs](#inputs)
* [Outputs](#outputs)
* [Events](#events)
* [`push*`](#push)
* [`pull_request*`](#pull_request)
* [`tag*`](#tag)
* [Other supported events](#other-supported-events)
* [Possible usage with actions/checkout](#possible-usage-with-actionscheckout)
* [Credits](#credits)
* [Report Bugs](#report-bugs)
* [Contributors ✨](#contributors-)
Get a branch or tag name without the `/ref/*` prefix
## Features
@ -44,35 +28,31 @@ Get a branch or tag name without the `/ref/*` prefix.
## Usage
```yaml
on:
push:
branches:
- main
pull_request:
branches:
- main
...
steps:
- name: Get branch names.
id: branch-names
uses: tj-actions/branch-names@v8
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6
- name: Running on the default branch.
if: steps.branch-names.outputs.is_default == 'true'
if: steps.branch-name.outputs.is_default == 'true'
run: |
echo "Running on default: ${{ steps.branch-names.outputs.current_branch }}"
# Outputs: "Running on default: main"
echo "Running on default: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on default: main".
- name: Running on a pull request branch.
if: steps.branch-names.outputs.is_default == 'false'
if: steps.branch-name.outputs.is_default == 'false'
run: |
echo "Running on pr: ${{ steps.branch-names.outputs.current_branch }}"
# Outputs: "Running on pr: feature/test"
- name: Running on a pull request branch.
if: steps.branch-names.outputs.is_default == 'false'
run: |
echo "Base branch: ${{ steps.branch-names.outputs.base_ref_branch }}"
# Outputs: "Base branch: main"
- name: Running on any event.
run: |
echo "Default branch: ${{ steps.branch-names.outputs.default_branch }}"
# Outputs: "Default branch: main"
echo "Running on pr: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on pr: feature/test".
```
If you feel generous and want to show some extra appreciation:
@ -85,45 +65,36 @@ Support this project with a :star:
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
## Inputs
<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->
```yaml
- uses: tj-actions/branch-names@v8
id: branch-names
with:
# The prefix that should be
# stripped from the tag e.g
# `v` -> with a tag
# `v0.0.1` -> returns `0.0.1`
# Type: string
strip_tag_prefix: ''
```
<!-- AUTO-DOC-INPUT:END -->
## Outputs
<!-- AUTO-DOC-OUTPUT:START - Do not remove or modify this section -->
| OUTPUT | TYPE | DESCRIPTION |
|---------------------------------------------------------------------------------|--------|----------------------------------------------------------------------------------|
| <a name="output_base_ref_branch"></a>[base\_ref\_branch](#output_base_ref_branch) | string | The target branch of a <br>pull request or tag e.g <br>`main` |
| <a name="output_current_branch"></a>[current\_branch](#output_current_branch) | string | The current branch name regardless <br>of event\_type e.g `main`, `feature/test` |
| <a name="output_default_branch"></a>[default\_branch](#output_default_branch) | string | The default branch name e.g <br>`main` OR `master` |
| <a name="output_head_ref_branch"></a>[head\_ref\_branch](#output_head_ref_branch) | string | The source branch of a <br>pull request e.g `feature/test` |
| <a name="output_is_default"></a>[is\_default](#output_is_default) | string | Returns `"true"` if the current <br>branch is the default else <br>`"false"`. |
| <a name="output_is_tag"></a>[is\_tag](#output_is_tag) | string | Returns `"true"` if the current <br>branch is a tag else <br>`"false"`. |
| <a name="output_ref_branch"></a>[ref\_branch](#output_ref_branch) | string | The branch that triggered the <br>workflow run. e.g `1/merge`, `main` |
| <a name="output_tag"></a>[tag](#output_tag) | string | The tag that triggered the <br>workflow run. e.g `v0.0.1`, `0.0.1` |
| OUTPUT | TYPE | DESCRIPTION |
|-----------------|--------|--------------------------------------------------------------------------------|
| base\_ref\_branch | string | The target branch of a pull request<br>or tag e.g `main` |
| current\_branch | string | The current branch name regardless of event\_type<br>e.g `main`, `feature/test` |
| default\_branch | string | The default branch name e.g `main` OR<br>`master` |
| head\_ref\_branch | string | The source branch of a pull request<br>e.g `feature/test` |
| is\_default | string | Returns `"true"` if the current branch is<br>the default else `"false"`. |
| is\_tag | string | Returns `"true"` if the current branch is<br>a tag else `"false"`. |
| ref\_branch | string | The branch that triggered the workflow run.<br>e.g `1/merge`, `main` |
| tag | string | The tag that triggered the workflow run.<br>e.g `v0.0.1`, `0.0.1` |
<!-- AUTO-DOC-OUTPUT:END -->
## Inputs
<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|------------------|--------|----------|---------|----------------------------------------------------------------------------------------------|
| strip\_tag\_prefix | string | false | | The prefix that should be stripped from<br>the tag e.g `v0.0.1` -> `(strip v)`<br>-> `0.0.1` |
<!-- AUTO-DOC-INPUT:END -->
## Events
### `push*`
* `push*`
```yaml
on:
@ -134,38 +105,38 @@ on:
...
steps:
- name: Get branch names
id: branch-names
uses: tj-actions/branch-names@v8
id: branch-name
uses: tj-actions/branch-names@v6
- name: Current branch names
- name: Current branch name
run: |
echo "${{ steps.branch-names.outputs.current_branch }}"
echo "${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "main" the branch that triggered the push event.
- name: Running on the default branch.
if: steps.branch-names.outputs.is_default == 'true'
if: steps.branch-name.outputs.is_default == 'true'
run: |
echo "Running on default: ${{ steps.branch-names.outputs.current_branch }}"
echo "Running on default: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on default: main".
- name: Running on the default branch (i.e non tag based branch).
if: steps.branch-names.outputs.is_tag == 'false' && steps.branch-names.outputs.is_default == 'true'
if: steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default == 'true'
run: |
echo "Running on branch: ${{ steps.branch-names.outputs.current_branch }}"
echo "Running on branch: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on branch: main".
- name: Get Ref brach name
run: |
echo "${{ steps.branch-names.outputs.ref_branch }}"
echo "${{ steps.branch-name.outputs.ref_branch }}"
# Outputs: "main"
- name: Default branch name
run: |
echo "${{ steps.branch-names.outputs.default_branch }}"
echo "${{ steps.branch-name.outputs.default_branch }}"
# Outputs: "main" the default branch.
```
### `pull_request*`
* `pull_request*`
```yaml
on:
@ -176,48 +147,48 @@ on:
...
steps:
- name: Get branch names
id: branch-names
uses: tj-actions/branch-names@v8
id: branch-name
uses: tj-actions/branch-names@v6
- name: Current branch names
- name: Current branch name
run: |
echo "${{ steps.branch-names.outputs.current_branch }}"
echo "${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "feature/test" current PR branch.
- name: Running on a non tag based branch and a PR branch.
if: steps.branch-names.outputs.is_default == 'false'
if: steps.branch-name.outputs.is_default == 'false'
run: |
echo "Running on branch: ${{ steps.branch-names.outputs.current_branch }}"
echo "Running on branch: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on branch: feature/test".
- name: Running on a pull request (i.e non tag based branch).
if: steps.branch-names.outputs.is_tag == 'false' && steps.branch-names.outputs.is_default == 'false'
if: steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default == 'false'
run: |
echo "Running on branch: ${{ steps.branch-names.outputs.current_branch }}"
echo "Running on branch: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on branch: feature/test".
- name: Get Ref branch name
run: |
echo "${{ steps.branch-names.outputs.ref_branch }}"
echo "${{ steps.branch-name.outputs.ref_branch }}"
# Outputs: "1/merge"
- name: Get Head Ref branch names (i.e The current pull request branch)
- name: Get Head Ref branch name (i.e The current pull request branch)
run: |
echo "${{ steps.branch-names.outputs.head_ref_branch }}"
echo "${{ steps.branch-name.outputs.head_ref_branch }}"
# Outputs: "feature/test" current PR branch.
- name: Get Base Ref branch names (i.e The target of a pull request.)
- name: Get Base Ref branch name (i.e The target of a pull request.)
run: |
echo "${{ steps.branch-names.outputs.base_ref_branch }}"
echo "${{ steps.branch-name.outputs.base_ref_branch }}"
# Outputs: "main".
- name: Default branch names
- name: Default branch name
run: |
echo "${{ steps.branch-names.outputs.default_branch }}"
echo "${{ steps.branch-name.outputs.default_branch }}"
# Outputs: "main" the default branch.
```
### `tag*`
* `tag*`
```yaml
on:
@ -228,29 +199,23 @@ on:
...
steps:
- name: Get branch names
id: branch-names
uses: tj-actions/branch-names@v8
with:
strip_tag_prefix: v # Optionally strip the leading `v` from the tag.
id: branch-name
uses: tj-actions/branch-names@v6
- name: Running on a tag branch.
if: steps.branch-names.outputs.is_tag == 'true'
if: steps.branch-name.outputs.is_tag == 'true'
run: |
echo "Running on: ${{ steps.branch-names.outputs.tag }}"
# Outputs: "Running on: 0.0.1".
echo "Running on: ${{ steps.branch-name.outputs.tag }}"
# Outputs: "Running on: v0.0.1".
- name: Get the current tag
if: steps.branch-names.outputs.is_tag == 'true' # Replaces: startsWith(github.ref, 'refs/tags/')
if: steps.branch-name.outputs.is_tag == 'true' # Replaces: startsWith(github.ref, 'refs/tags/')
run: |
echo "${{ steps.branch-names.outputs.tag }}"
# Outputs: "0.0.1"
echo "${{ steps.branch-name.outputs.tag }}"
# Outputs: "v0.0.1" OR "0.0.1"
```
### Other supported events
See [.github/workflows/test.yml](https://github.com/tj-actions/branch-names/blob/main/.github/workflows/test.yml) for more examples.
### Possible usage with [actions/checkout](https://github.com/actions/checkout)
### Possible usage with [actions/checkout@v2](https://github.com/actions/checkout):
```yaml
on:
@ -264,8 +229,8 @@ on:
steps:
- name: Get branch names.
id: branch-names
uses: tj-actions/branch-names@v8
- uses: actions/checkout@v4
uses: tj-actions/branch-names@v6
- uses: actions/checkout@v2
with:
ref: ${{ steps.branch-names.outputs.head_ref_branch }}
```
@ -297,13 +262,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/loarca"><img src="https://avatars.githubusercontent.com/u/22898638?v=4?s=100" width="100px;" alt="Alejandro Loarca"/><br /><sub><b>Alejandro Loarca</b></sub></a><br /><a href="https://github.com/tj-actions/branch-names/commits?author=loarca" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://ianwoodard.me"><img src="https://avatars.githubusercontent.com/u/17186604?v=4?s=100" width="100px;" alt="Ian Woodard"/><br /><sub><b>Ian Woodard</b></sub></a><br /><a href="https://github.com/tj-actions/branch-names/commits?author=IanWoodard" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://home.boidol.dev/"><img src="https://avatars.githubusercontent.com/u/652404?v=4?s=100" width="100px;" alt="Raphael Boidol"/><br /><sub><b>Raphael Boidol</b></sub></a><br /><a href="https://github.com/tj-actions/branch-names/commits?author=boidolr" title="Documentation">📖</a></td>
</tr>
</tbody>
<tr>
<td align="center"><a href="https://github.com/loarca"><img src="https://avatars.githubusercontent.com/u/22898638?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alejandro Loarca</b></sub></a><br /><a href="https://github.com/tj-actions/branch-names/commits?author=loarca" title="Code">💻</a></td>
</tr>
</table>
<!-- markdownlint-restore -->

View File

@ -1,32 +0,0 @@
# Security Policy
## Proactive Security Measures
To proactively detect and address security vulnerabilities, we utilize several robust tools and processes:
- **Dependency Updates:** We use [Renovate](https://renovatebot.com) and [Dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates) to keep our dependencies updated and promptly patch detected vulnerabilities through automated PRs.
- **[GitHub's Security Features](https://github.com/features/security):** Our repository and dependencies are continuously monitored via GitHub's security features, which include:
- **Code Scanning:** Using GitHub's CodeQL, all pull requests are scanned to identify potential vulnerabilities in our source code.
- **Automated Alerts:** Dependabot identifies vulnerabilities based on the GitHub Advisory Database and opens PRs with patches, while automated [secret scanning](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-partner-patterns) provides alerts for detected secrets.
- **[GitGuardian Security Checks](https://www.gitguardian.com/):** We employ GitGuardian to ensure security checks are performed on the codebase, enhancing the overall security of our project.
- **Code Analysis and Security Scanning:** With the help of [Codacy Static Code Analysis](https://www.codacy.com/) and [Codacy Security Scan](https://security.codacy.com/), we conduct thorough analyses and scans of our code for potential security risks.
## Reporting Security Vulnerabilities
Despite our best efforts to deliver secure software, we acknowledge the invaluable role of the community in identifying security breaches.
### Private Vulnerability Disclosures
We request all suspected vulnerabilities to be responsibly and privately disclosed by sending an email to [support@tj-actions.online](mailto:support@tj-actions.online).
### Public Vulnerability Disclosures
For publicly disclosed security vulnerabilities, please **IMMEDIATELY** email [support@tj-actions.online](mailto:support@tj-actions.online) with the details for prompt action.
Upon confirmation of a breach, reporters will receive full credit and recognition for their contribution. Please note, that we do not offer monetary compensation for reporting vulnerabilities.
## Communication of Security Breaches
We will utilize the [GitHub Security Advisory](https://github.com/tj-actions/branch-names/security/advisories) to communicate any security breaches. The advisory will be made public once a patch has been released to rectify the issue.
We appreciate your cooperation and contribution to maintaining the security of our software. Remember, a secure community is a strong community.

View File

@ -1,9 +1,9 @@
name: Branch Names
description: Retrieve github branch or tag information without the /ref/* prefix
description: Retrieve giithub branch or tag information without the /ref/* prefix
author: tj-actions
inputs:
strip_tag_prefix:
description: 'The prefix that should be stripped from the tag e.g `v` -> with a tag `v0.0.1` -> returns `0.0.1`'
description: 'The prefix that should be stripped from the tag e.g `v0.0.1` -> `(strip v)` -> `0.0.1`'
default: ''
required: false
@ -37,82 +37,100 @@ runs:
using: "composite"
steps:
- id: branch
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref || github.base_ref }}
GITHUB_HEAD_REF: ${{ github.event.pull_request.head.ref || github.head_ref }}
GITHUB_EVENT_BASE_REF: ${{ github.event.base_ref }}
INPUTS_STRIP_TAG_PREFIX: ${{ inputs.strip_tag_prefix }}
run: |
# "Set branch names..."
if [[ "$GITHUB_REF" != "refs/tags/"* ]]; then
BASE_REF=$(printf "%q" "$GITHUB_BASE_REF")
HEAD_REF=$(printf "%q" "$GITHUB_HEAD_REF")
REF=$(printf "%q" "$GITHUB_REF")
if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then
BASE_REF=$(printf "%q" "${{ github.base_ref }}")
HEAD_REF=$(printf "%q" "${{ github.head_ref }}")
REF=$(printf "%q" "${{ github.ref }}")
BASE_REF=${BASE_REF/refs\/heads\//}
HEAD_REF=${HEAD_REF/refs\/heads\//}
REF_BRANCH=${REF/refs\/pull\//}
REF_BRANCH=${REF_BRANCH/refs\/heads\//}
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
echo "head_ref_branch=$(eval printf "%s" "$HEAD_REF")" >> "$GITHUB_OUTPUT"
echo "ref_branch=$(eval printf "%s" "$REF_BRANCH")" >> "$GITHUB_OUTPUT"
if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=base_ref_branch::$(eval printf "%s" "$BASE_REF")"
echo "::set-output name=head_ref_branch::$(eval printf "%s" "$HEAD_REF")"
echo "::set-output name=ref_branch::$(eval printf "%s" "$REF_BRANCH")"
else
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
echo "head_ref_branch=$(eval printf "%s" "$HEAD_REF")" >> "$GITHUB_OUTPUT"
echo "ref_branch=$(eval printf "%s" "$REF_BRANCH")" >> "$GITHUB_OUTPUT"
fi
else
BASE_REF=$(printf "%q" "$GITHUB_EVENT_BASE_REF")
BASE_REF=${BASE_REF/refs\/heads\/$INPUTS_STRIP_TAG_PREFIX/}
BASE_REF=$(printf "%q" "${{ github.event.base_ref }}")
BASE_REF=${BASE_REF/refs\/heads\/${{ inputs.strip_tag_prefix }}/}
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=base_ref_branch::$(eval printf "%s" "$BASE_REF")"
else
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
fi
fi
shell: bash
- id: current_branch
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
HEAD_REF_BRANCH: ${{ steps.branch.outputs.head_ref_branch }}
REF_BRANCH: ${{ steps.branch.outputs.ref_branch }}
run: |
# "Set the current branch name..."
if [[ "$GITHUB_REF" != "refs/tags/"* ]]; then
if [[ "$GITHUB_EVENT_NAME" == *"pull_request"* ]]; then
echo "current_branch=$HEAD_REF_BRANCH" >> "$GITHUB_OUTPUT"
if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then
if [[ ${{ github.event_name }} == 'pull_request' || ${{ github.event_name }} == 'pull_request_target' ]]; then
if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=current_branch::${{ steps.branch.outputs.head_ref_branch }}"
else
echo "current_branch=${{ steps.branch.outputs.head_ref_branch }}" >> "$GITHUB_OUTPUT"
fi
else
echo "current_branch=$REF_BRANCH" >> "$GITHUB_OUTPUT"
if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=current_branch::${{ steps.branch.outputs.ref_branch }}"
else
echo "current_branch=${{ steps.branch.outputs.ref_branch }}" >> "$GITHUB_OUTPUT"
fi
fi
fi
shell: bash
- id: default
env:
GITHUB_REF: ${{ github.ref }}
CURRENT_BRANCH: ${{ steps.current_branch.outputs.current_branch }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
FORK: ${{ github.event.pull_request.head.repo.fork }}
run: |
# "Set the default branch name..."
if [[ "$GITHUB_REF" != "refs/tags/"* ]]; then
if [[ "$CURRENT_BRANCH" == "$DEFAULT_BRANCH" && "$FORK" != "true" ]]; then
echo "is_default=true" >> "$GITHUB_OUTPUT"
echo "default_branch=$DEFAULT_BRANCH" >> "$GITHUB_OUTPUT"
if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then
if [[ "${{ steps.current_branch.outputs.current_branch }}" == "${{ github.event.repository.default_branch }}" && "${{ github.event.pull_request.head.repo.fork }}" != "true" ]]; then
if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=is_default::true"
echo "::set-output name=default_branch::${{ github.event.repository.default_branch }}"
else
echo "is_default=true" >> "$GITHUB_OUTPUT"
echo "default_branch=${{ github.event.repository.default_branch }}" >> "$GITHUB_OUTPUT"
fi
else
echo "is_default=false" >> "$GITHUB_OUTPUT"
echo "default_branch=$DEFAULT_BRANCH" >> "$GITHUB_OUTPUT"
if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=is_default::false"
echo "::set-output name=default_branch::${{ github.event.repository.default_branch }}"
else
echo "is_default=false" >> "$GITHUB_OUTPUT"
echo "default_branch=${{ github.event.repository.default_branch }}" >> "$GITHUB_OUTPUT"
fi
fi
fi
shell: bash
- id: tag
env:
GITHUB_REF: ${{ github.ref }}
INPUTS_STRIP_TAG_PREFIX: ${{ inputs.strip_tag_prefix }}
run: |
# "Set the tag name..."
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
REF=$(printf "%q" "$GITHUB_REF")
TAG="${REF/refs\/tags\/$INPUTS_STRIP_TAG_PREFIX/}"
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
REF=$(printf "%q" "${{ github.ref }}")
TAG=${REF/refs\/tags\/${{ inputs.strip_tag_prefix }}/}
echo "tag=$(eval printf "%s" "$TAG")" >> "$GITHUB_OUTPUT"
echo "is_tag=true" >> "$GITHUB_OUTPUT"
if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=tag::$(eval printf "%s" "$TAG")"
echo "::set-output name=is_tag::true"
else
echo "tag=$(eval printf "%s" "$TAG")" >> "$GITHUB_OUTPUT"
echo "is_tag=true" >> "$GITHUB_OUTPUT"
fi
else
echo "is_tag=false" >> "$GITHUB_OUTPUT"
if [[ -z "$GITHUB_OUTPUT" ]]; then
echo "::set-output name=is_tag::false"
else
echo "is_tag=false" >> "$GITHUB_OUTPUT"
fi
fi
shell: bash

View File

@ -7,8 +7,7 @@
"prConcurrentLimit": 5,
"rebaseWhen": "behind-base-branch",
"addLabels": [
"dependencies",
"merge when passing"
"dependencies"
],
"assignees": [
"jackton1"
@ -20,21 +19,13 @@
"enabled": true,
"automerge": true
},
"nvm": {
"enabled": false
},
"packageRules": [
{
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
],
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true,
"rebaseWhen": "behind-base-branch",
"addLabels": [
"merge when passing"
"automerge"
]
},
{
@ -42,15 +33,10 @@
"matchLanguages": [
"docker"
],
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
],
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"rebaseWhen": "behind-base-branch",
"addLabels": [
"merge when passing"
"automerge"
],
"automerge": true
}