| 1 |
name: Changelog Bot Runner |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_run: |
| 5 |
workflows: ["Changelog Bot Trigger"] |
| 6 |
types: |
| 7 |
- completed |
| 8 |
|
| 9 |
permissions: |
| 10 |
actions: read |
| 11 |
|
| 12 |
jobs: |
| 13 |
fetch-metadata: |
| 14 |
runs-on: ubuntu-latest |
| 15 |
if: github.event.workflow_run.conclusion == 'success' |
| 16 |
permissions: |
| 17 |
actions: read |
| 18 |
outputs: |
| 19 |
pr_number: ${{ steps.metadata.outputs.pr_number }} |
| 20 |
steps: |
| 21 |
- name: Download PR metadata |
| 22 |
id: download |
| 23 |
uses: actions/download-artifact@v8 |
| 24 |
with: |
| 25 |
name: changelog-metadata |
| 26 |
github-token: ${{ secrets.GITHUB_TOKEN }} |
| 27 |
run-id: ${{ github.event.workflow_run.id }} |
| 28 |
continue-on-error: true |
| 29 |
|
| 30 |
- name: Read PR metadata |
| 31 |
if: steps.download.outcome == 'success' |
| 32 |
id: metadata |
| 33 |
run: | |
| 34 |
PR_NUMBER=$(cat pr_number) |
| 35 |
if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then |
| 36 |
echo "::error::Invalid PR number: $PR_NUMBER" |
| 37 |
exit 1 |
| 38 |
fi |
| 39 |
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT |
| 40 |
|
| 41 |
changelog: |
| 42 |
needs: fetch-metadata |
| 43 |
if: needs.fetch-metadata.outputs.pr_number != '' |
| 44 |
permissions: |
| 45 |
contents: read |
| 46 |
pull-requests: write |
| 47 |
issues: write |
| 48 |
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-changelog.yml@master |
| 49 |
with: |
| 50 |
pr_number: ${{ needs.fetch-metadata.outputs.pr_number }} |
| 51 |
secrets: |
| 52 |
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} |
| 53 |
OPENWISP_BOT_APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }} |
| 54 |
OPENWISP_BOT_PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }} |