Files
dependabot[bot] dd8662d354 Bump actions/github-script from 7 to 8
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 01:03:18 +00:00

48 lines
1.4 KiB
YAML

name: Post Merged.md on PR Close
on:
pull_request_target:
types:
- closed
jobs:
post-merged-md:
runs-on: ubuntu-latest
steps:
# Check if the PR was merged
- id: create_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Check if PR was merged
id: pr-merge-check
uses: actions/github-script@v8
with:
script: |
return context.payload.pull_request.merged
# Fetch merged.md content if PR was merged
- name: Fetch merged.md content
if: steps.pr-merge-check.outputs.result == 'true'
run: |
curl -o merged.md https://raw.githubusercontent.com/open-domains/.github/main/merged.md
# Post the content of merged.md as a comment using the custom token
- name: Post comment on PR
if: steps.pr-merge-check.outputs.result == 'true'
uses: actions/github-script@v8
with:
github-token: ${{ steps.create_token.outputs.token }}
script: |
const fs = require('fs');
const content = fs.readFileSync('merged.md', 'utf8');
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: content
});