Skip to content

Trigger from PDK release #220

Trigger from PDK release

Trigger from PDK release #220

Workflow file for this run

name: 'On PDK update'
on:
repository_dispatch:
types: [pdk-update]
run-name: 'Trigger from PDK release ${{ github.event.client_payload.version }}'
jobs:
store:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: myparcelnl/actions/setup-app-credentials@v4
id: credentials
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
- name: 'Store update information'
id: store
env:
GITHUB_TOKEN: ${{ steps.credentials.outputs.token }}
shell: bash
# language=bash
run: |
gh variable set PDK_LAST_UPDATE_TIMESTAMP --body "$(date +%s)"
trigger-push:
needs:
- store
runs-on: ubuntu-22.04
steps:
- uses: benc-uk/workflow-dispatch@v1
with:
ref: main
workflow: push.yml
- name: 'Report'
shell: bash
env:
PR_NUMBER: ${{ matrix.pr.number }}
PR_REF: ${{ matrix.pr.ref }}
#language=bash
run: |
buildUrl="${REPO_URL}/actions/workflows/push.yml"
echo "✅ Triggered a [new build](${buildUrl}) on the main branch" >> $GITHUB_STEP_SUMMARY
prepare-prs:
needs:
- store
runs-on: ubuntu-22.04
outputs:
pr-data: ${{ steps.pulls.outputs.result }}
steps:
- uses: myparcelnl/actions/setup-app-credentials@v4
id: credentials
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
- name: 'Get pull requests'
id: pulls
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
#language=javascript
script: |
const {data} = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
return data.map(pr => ({
number: pr.number,
ref: pr.head.ref
}));
trigger-prs:
needs:
- prepare-prs
runs-on: ubuntu-22.04
strategy:
matrix:
pr: ${{ fromJSON(needs.prepare-prs.outputs.pr-data) }}
steps:
- uses: myparcelnl/actions/repository-dispatch@v4
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
event-type: trigger-pr-build
client-payload: ${{ toJSON(matrix.pr) }}
- name: 'Report'
shell: bash
env:
PR_NUMBER: ${{ matrix.pr.number }}
REPO_URL: '${{ github.server_url }}/${{ github.repository }}'
#language=bash
run: |
prUrl="${REPO_URL}/pull/${PR_NUMBER}"
buildUrl="${REPO_URL}/actions/workflows/pull-request.yml"
echo "✅ Triggered a [new build](${buildUrl}) for [PR #${PR_NUMBER}](${prUrl})" >> $GITHUB_STEP_SUMMARY