Skip to content

Test push zip file into self #5

Test push zip file into self

Test push zip file into self #5

name: API Specs ZIP Generator
on:
workflow_call:
pull_request:
branches: [develop, stage, preview, main, previous]
jobs:
ZIP-Generator-Actions:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- run: echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Creating new temp sub dir called `tools`
run: |
mkdir -m 777 tools
cd tools
pwd
ls -la
- name: Check out ${{ github.repository }} Repo code at ${{ github.workspace }}
uses: actions/checkout@main
with:
repository: ${{ github.repository }}
path: ${{ github.workspace }}
- name: Check out Fiserv/remote-actions Repo code at ${{ github.workspace }}/tools
uses: actions/checkout@main
with:
repository: Fiserv/remote-actions
ref: main
path: ${{ github.workspace }}/tools
- name: List files in the repository
run: |
cd ${{ github.workspace }}
pwd
ls -la
cd ${{ github.workspace }}/tools
pwd
ls -la
- run: echo "πŸ’‘ The ${{ github.repository }} repository has been cloned on root"
- run: echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
pwd
ls -la
- name: Cache node modules
id: cache-npm
uses: actions/cache@main
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: Running API Specs ZIP Generator.....
run: |
pwd
cd ${{ github.workspace }}/tools/scripts
ls -la
npmv=$(npm --version)
echo "NPM version installed : " $npmv
nodev=$(node --version)
echo "Node version installed : " $nodev
npm install
echo " Repo: ${{ github.repository }}"
echo " Space: ${{ github.workspace }}"
result=$(npm run download ${{github.workspace }})
echo "**********TEST RESULTS*********************"
echo "$result"
if [[ $result == *'ZIP GENERATOR FAILED'* ]] ;then
echo "Validator failed and exiting the Job..."
exit 1
elif [[ $result == *'PASSED'* ]] ;then
echo "Validator Ran Successfully....🍏"
fi
- run: echo "🍏 This job's status is ${{ job.status }}."
- name: Show file content
run: |
pwd
ls -la
cd assets
ls -lah
mv *.zip ./files
echo "Setting postBuffer to 104857600"
git config --global http.postBuffer 104857600
- name: Commit zip files
run: |
# Your commands to make changes
echo "Uploading autogenerated zip files"
ls
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add assets/files
git commit -m "Uploading autogenerated zip files"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ZIP_GENERATOR_ACTION }}
force_with_lease: true
branch: ${{ github.ref }}
- name: Upload ZIP Artifacts
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ github.event.repository.name }}_${{ github.ref_name }}-zip-files
path: ${{ github.workspace }}/assets/${{ github.event.repository.name }}*.zip
# - name: Create Pull Request
# uses: peter-evans/create-pull-request@main
# with:
# token: ${{ secrets.ZIP_GENERATOR_ACTION }}
# commit-message: "Zip Generator Action"
# branch: update-zip-files
# title: "Zip Generator Action PR"
# body: "This PR was created automatically by Github ZIP Generator Action."
# - name: Merge Pull Request
# uses: peter-evans/merge-pull-request@main
# with:
# token: ${{ secrets.ZIP_GENERATOR_ACTION }}
# pull-request: ${{ steps.create_pull_request.outputs.pull-request-number }}
# merge-method: squash