Remove Sustainability Director and Policy #47
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Comment helpful links on new pull requests | |
| on: | |
| pull_request_target: | |
| paths: | |
| - '**/*.md' | |
| - '.github/workflows/generate-html-pdfs.yml' | |
| - 'scripts/**/*' | |
| - '!**/README.md' | |
| - '!**/LICENSE*' | |
| branches-ignore: | |
| - gh-pages | |
| types: | |
| - opened | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| link-html: | |
| name: Post relevant links | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get GitHub Pages link | |
| id: link | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO: ${{ github.event.pull_request.head.repo.full_name }} | |
| PAGES_URL: ${{ github.event.pull_request.head.repo.html_url }}/settings/pages | |
| HEAD: ${{ github.head_ref }} | |
| MAIN: ${{ github.event.pull_request.head.repo.default_branch }} | |
| PR: ${{ github.event.pull_request.number }} | |
| BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }} | |
| run: | | |
| if URL="$(gh api "repos/$REPO/pages" --jq '.html_url')"; then | |
| if [ "$HEAD" != "$MAIN" ]; then | |
| URL="${URL}branch/$HEAD" | |
| fi | |
| echo "url=$URL" >> "$GITHUB_OUTPUT" | |
| else | |
| MSG='GitHub Pages has not yet been set up. Please set the Branch for build and deployment to `gh-pages` here:' | |
| MSG="$MSG $PAGES_URL" | |
| gh pr close "$PR" --repo "$BASE_REPO" --comment "$MSG" | |
| exit 1 | |
| fi | |
| - name: Post link | |
| uses: actions/github-script@v7 | |
| env: | |
| OWNER: ${{ github.event.pull_request.head.repo.owner.login }} | |
| REPO: ${{ github.event.pull_request.head.repo.name }} | |
| PAGE_URL: ${{ steps.link.outputs.url }} | |
| DIFF_URL: ${{ github.event.pull_request.html_url }}/files | |
| PDF_URL: ${{ github.event.pull_request.head.repo.html_url }}/actions/workflows/generate-html-pdfs.yml | |
| BASE: ${{ github.base_ref }} | |
| DEFAULT: ${{ github.event.repository.default_branch }} | |
| with: | |
| script: | | |
| let body = `Please remember to check [the diff](${process.env.DIFF_URL}) for reference warnings. Successful HTML builds will appear at ${process.env.PAGE_URL} | |
| Successful PDF builds will appear in the Artifacts section of the latest [workflow run](${process.env.PDF_URL}). Alternatively, print-to-PDF on Chrome from the HTML build will produce the same PDF build.`; | |
| if (process.env.BASE == process.env.DEFAULT) { | |
| body += ` After this pull request is merged, the PDFs will be updated in the repository automatically.`; | |
| } | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); |