Skip to content

Merge pull request #773 from Epic-Breakfast-Productions/all-contribut… #904

Merge pull request #773 from Epic-Breakfast-Productions/all-contribut…

Merge pull request #773 from Epic-Breakfast-Productions/all-contribut… #904

name: Deployment - Repos - Test
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
workflow_call:
workflow_dispatch:
branches: [ "**" ]
defaults:
run:
working-directory: "utilities"
jobs:
deployToTestRepos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install -y curl dpkg-dev
- name: Setup Signing Key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.OQM_GPG_KEY }}
passphrase: ${{ secrets.OQM_GPG_KEY_PASS }}
- name: Update Test Repo Files
run: ./update-test-repositories.sh
- name: Stash
run: git stash
- name: Git status
run: git status
- name: Swap to main branch
if: github.ref_name != 'main'
uses: actions/checkout@v4
with:
ref: main
- name: Git status
run: git status
- name: Git log
run: git log
- name: Unstash
run: git stash pop
- name: Commit new repo files
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Updated Repositories after release
branch: 'update-test-repos-staging-${{ github.ref_name }}'
create_branch: true
push_options: '--force'
- name: Create Pull Request
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const pulls = await github.rest.pulls.list({
owner: owner,
repo: repo,
head: 'update-test-repos-staging-${{ github.ref_name }}',
base: 'main',
state: 'open',
});
if (pulls.data.length < 1) {
await github.rest.pulls.create({
title: '[Delpoy - Repos - Test] Update test repo files for branch ${{ github.ref_name }}',
owner: owner,
repo: repo,
head: 'update-test-repos-staging-${{ github.ref_name }}',
base: 'main',
body: [
'This PR is auto-generated by',
'[actions/github-script](https://github.com/actions/github-script)',
].join('\n'),
});
} else {
const existingPR = pulls.data[0];
await github.rest.pulls.update({
owner: owner,
repo: repo,
pull_number: existingPR.number,
body: [
existingPR.body,
`Updated by Job ${context.job}`,
].join('\n'),
});
}