Skip to content

Create test build onto the fix/avoid-actions-malicious-input branch by @eason9487 #18

Create test build onto the fix/avoid-actions-malicious-input branch by @eason9487

Create test build onto the fix/avoid-actions-malicious-input branch by @eason9487 #18

name: GitHub Actions - Create Test Build
run-name: Create test build onto the ${{ github.ref_name }} branch by @${{ github.actor }}
on:
workflow_dispatch:
jobs:
CreateTestBuild:
name: Create Test Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Prepare node
uses: ./packages/github-actions/actions/prepare-node
with:
node-version: 14
cache-dependency-path: ./packages/github-actions/package-lock.json
install-deps: "no"
- name: Create and commit test build
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
TEST_BRANCH_NAME="${BRANCH_NAME}-test-build"
.github/scripts/github-actions-create-and-commit-build.sh "$REPO_URL" "$BRANCH_NAME"
# This `git checkout HEAD^` is to prevent errors from the post jobs like "Prepare node".
git checkout HEAD^ -- ./packages/github-actions/actions
# Set/update the test branch
git push --force origin "HEAD:refs/heads/${TEST_BRANCH_NAME}"
# Set summary
echo "### :link: The test build has been created" >> $GITHUB_STEP_SUMMARY
echo "${REPO_URL}/tree/${TEST_BRANCH_NAME}" >> $GITHUB_STEP_SUMMARY
echo "### :zap: Use the test build" >> $GITHUB_STEP_SUMMARY
echo "In the repo where you want to test custom actions with this test build, specify the \`uses\` with \`${{ github.repository }}/ACTION_PATH_TO_BE_TESTED@${TEST_BRANCH_NAME}\`." >> $GITHUB_STEP_SUMMARY