Skip to content

chore: bootstrap release-please config (#81) #160

chore: bootstrap release-please config (#81)

chore: bootstrap release-please config (#81) #160

Workflow file for this run

name: 'Test'
on:
workflow_call:
inputs:
branch_ref:
description: 'Which ref to pull'
type: string
workflow_dispatch:
inputs:
branch_ref:
description: 'Which ref to pull'
type: string
push:
branches:
- main
env:
CHECKOUT_REF: ${{ github.event_name == 'push' && github.ref || inputs.branch_ref }}
jobs:
test-branch-on-remote: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_on_remote-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
git status --porcelain=v2 --branch --untracked-files=no
echo $BRANCH_NAME > "test-file.txt"
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: true
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 1 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-branch-not-on-remote: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_not_on_remote-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git status --porcelain=v2 --branch --untracked-files=no
echo $BRANCH_NAME > "test-file.txt"
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: true
create-branch-on-remote: true
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 1 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-not-stage-all-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_not_stage_all_files-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
echo $BRANCH_NAME > "test-file1.txt"
echo $BRANCH_NAME > "test-file2.txt"
git add test-file1.txt
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: false
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 1 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-stage-all-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_stage_all_files-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
echo $BRANCH_NAME > "test-file1.txt"
echo $BRANCH_NAME > "test-file2.txt"
git add test-file1.txt
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: true
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 2 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-multiple-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_multiple_files-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
file_content="$(mktemp temp-random-file-XXXXXX)"
# generate a file with 500KB of As
yes A | head -c 500000 > "$file_content"
for i in {1..10}
do
cp "$file_content" "test-file$i.txt"
echo "test-file$i.txt size: $(stat -c '%s' test-file$i.txt)"
done
# remove the temp file as we don't want to commit it
rm "$file_content"
git add .
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: false
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 10 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 10 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-very-large-file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_very_large_file-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
# generate a file with 25MB of As
yes A | head -c 25000000 > test-file.txt
echo "test-file.txt size: $(stat -c '%s' test-file.txt)"
git add .
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: false
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 1 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-multiple-large-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_multiple_large_files-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
large_file="$(mktemp temp-random-file-XXXXXX)"
# generate a file with 2.5MB of As
yes A | head -c 2500000 > "$large_file"
for i in {1..10}
do
cp "$large_file" "test-file$i.txt"
echo "test-file$i.txt size: $(stat -c '%s' test-file$i.txt)"
done
# remove the temp file as we don't want to commit it
rm "$large_file"
git add .
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: false
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 10 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 10 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-file-rename: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_file_rename-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
mv test-files/test-renames.old test-files/test-renames.new
git add .
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: true
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 1 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-modify-file: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_modify-file-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
echo "new file content" >> test-files/test-modify.txt
git add .
# output status here to manually verify file changes
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: true
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 1 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-delete-file: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_delete-file-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
rm test-files/test-delete.txt
git add .
# output status here to manually verify file changes
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: true
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 1 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-token-url: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_token_url-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git config --global url.https://x-access-token:${{ inputs.token }}@github.com/.insteadOf https://github.com/
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
git status --porcelain=v2 --branch --untracked-files=no
echo $BRANCH_NAME > "test-file.txt"
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
with:
token: ${{ github.token }}
stage-all-files: true
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output
run: |
changedFilesIfAvailable=$(echo '${{ steps.test-action.outputs.commit-response }}' | jq -r '.data.createCommitOnBranch.commit.changedFilesIfAvailable')
if [[ -z "$changedFilesIfAvailable" || "$changedFilesIfAvailable" == "null" ]]; then
echo "Error: changedFilesIfAvailable is empty or null. Verify the output from test-action."
exit 1
fi
if [[ "$changedFilesIfAvailable" -ne 1 ]]; then
echo "Error: changedFilesIfAvailable is expected to be 1 but got $changedFilesIfAvailable."
exit 1
fi
echo "Validation passed: changedFilesIfAvailable is $changedFilesIfAvailable."
test-fail-if-no-changes: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_failure_no-changes-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
# output status here to manually verify file changes
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
continue-on-error: true
with:
token: ${{ github.token }}
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output is failure
if: ${{ steps.test-action.outcome == 'failure' }}
run: |
if [[ -z "${{ steps.test-action.outputs.commit-response }}" ]]; then
echo "Validation passed: commit-response is empty."
else
echo "Error: commit-response is expected to be empty but got not empty."
exit 1
fi
- name: Check output is success
if: ${{ steps.test-action.outcome == 'success' }}
run: |
echo "Error: action status is expected to be failure but got success."
exit 1
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}
test-success-if-no-changes: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup test branch
id: setup-test-branch
run: |
BRANCH_NAME="test_success_no-changes-$(date +%s)"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
# output status here to manually verify file changes
git status --porcelain=v2 --branch --untracked-files=no
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: ./
id: test-action
continue-on-error: true
with:
token: ${{ github.token }}
success-if-no-changes: true
commit-message: ${{ steps.setup-test-branch.outputs.branch-name }}
- name: Check output is failure
if: ${{ steps.test-action.outcome == 'failure' }}
run: |
echo "Error: action status is expected to be success but got failure."
exit 1
- name: Check output is success
if: ${{ steps.test-action.outcome == 'success' }}
run: |
if [[ -z "${{ steps.test-action.outputs.commit-response }}" ]]; then
echo "Validation passed: commit-response is empty."
else
echo "Error: commit-response is expected to be empty but got not empty."
exit 1
fi
- name: Delete test branch
if: ${{ always() }}
run: |
git push --force --delete origin ${{ steps.setup-test-branch.outputs.branch-name }}