Skip to content

rename to github-signed-commit #11

rename to github-signed-commit

rename to github-signed-commit #11

Workflow file for this run

name: tests
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: read
concurrency:
group: test-action
cancel-in-progress: true
jobs:
test-jest:
name: Jest Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install Dependencies
id: npm-ci
run: npm ci
- name: Check Format
id: npm-format-check
run: npm run format:check
- name: Lint
id: npm-lint
run: npm run lint
- name: Test
id: npm-ci-test
run: npm run ci-test
test-action-basic:
name: GitHub Actions Test (Basic)
runs-on: ubuntu-latest
permissions:
contents: write
env:
BRANCH: test-action-basic
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Test Action
id: test-action
uses: ./
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
test.txt
commit-message: Add Dummy Content
- name: Print Action Output
id: output
run: echo "${{ steps.test-action.outputs.commit-sha }}"
- name: Clean up test action branch
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
test-action-branch:
name: GitHub Actions Test (Custom Branch)
runs-on: ubuntu-latest
permissions:
contents: write
needs: test-action-basic
env:
BRANCH: test-action-branch
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: generate dummy content
shell: bash
run: |
touch test.txt && echo 'xyz' > test.txt
- name: Test Action
id: test-action
uses: ./
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
test.txt
commit-message: Add Dummy Content
branch-name: ${{ env.BRANCH }}
branch-push-force: true
- name: Print Action Output
id: output
run: echo "${{ steps.test-action.outputs.commit-sha }}"
- name: Clean up test action branch
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
test-action-workspace:
name: GitHub Actions Test (Workspace)
runs-on: ubuntu-latest
permissions:
contents: write
needs: test-action-branch
env:
BRANCH: test-action-workspace
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: generate dummy content
shell: bash
run: |
mkdir dummy
touch dummy/test.txt && echo '123' > dummy/test.txt
- name: Test Action
id: test-action
uses: ./
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
test.txt
commit-message: Add Dummy Content
branch-name: ${{ env.BRANCH }}
workspace: dummy
- name: Print Action Output
id: output
run: echo "${{ steps.test-action.outputs.commit-sha }}"
- name: Clean up test action branch
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
test-action-glob:
name: GitHub Actions Test (Glob)
runs-on: ubuntu-latest
permissions:
contents: write
needs: test-action-workspace
env:
BRANCH: test-action-glob
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: generate dummy content
shell: bash
run: |
touch test_1.txt && echo 'abc123' > test_1.txt
touch test_2.txt && echo 'abc456' > test_2.txt
- name: Test Action
id: test-action
uses: ./
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
test*.txt
commit-message: Add Dummy Content
branch-name: ${{ env.BRANCH }}
- name: Print Action Output
id: output
run: echo "${{ steps.test-action.outputs.commit-sha }}"
- name: Clean up test action branch
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi