Skip to content

Commit

Permalink
GitHub Actions "Create Token" Fix (#19089)
Browse files Browse the repository at this point in the history
* Don't use the Agent Integrations bot in pr-quick-check and run-validations.

* Add permissions for the publish-unit-test-result-action

* Add a dummy comment to trigger a test run.

* Appease the linter

* Undo dummy commit for testing.

* Revert "Add permissions for the publish-unit-test-result-action"

This reverts commit 76f2f3e.
  • Loading branch information
nubtron authored Nov 20, 2024
1 parent 3d09b28 commit 76996aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/pr-quick-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
name: Check PR
runs-on: ubuntu-22.04

permissions:
pull-requests: write

steps:
# Uncomment for testing purposes
# - uses: actions/checkout@v4
Expand Down Expand Up @@ -68,19 +71,11 @@ jobs:
- '*/changelog.d/*.removed'
- '*/changelog.d/*.major'
- name: Create token
uses: actions/create-github-app-token@v1
id: token-generator
with:
app-id: ${{ secrets.DD_AGENT_INTEGRATIONS_BOT_APP_ID }}
private-key: ${{ secrets.DD_AGENT_INTEGRATIONS_BOT_PRIVATE_KEY }}
repositories: integrations-core

- name: Comment
if: ${{ steps.changes.outputs.major_bump_fragments == 'true' }}
uses: actions/github-script@v7
with:
github-token: ${{ steps.token-generator.outputs.token }}
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
github.rest.issues.createComment({ issue_number, owner, repo, body: "The changelog type `changed` or `removed` was used in this Pull Request, so the next release will bump major version. Please make sure this is a breaking change, or use the `fixed` or `added` type instead." });
10 changes: 1 addition & 9 deletions .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,12 @@ jobs:
if: inputs.codeowners
run: ddev validate codeowners

- name: Create token
uses: actions/create-github-app-token@v1
id: token-generator
with:
app-id: ${{ secrets.DD_AGENT_INTEGRATIONS_BOT_APP_ID }}
private-key: ${{ secrets.DD_AGENT_INTEGRATIONS_BOT_PRIVATE_KEY }}
repositories: integrations-core

- name: Comment PR on failure
if: ${{ failure() && github.event.pull_request.merged != true }}
uses: actions/github-script@v7
continue-on-error: true
with:
github-token: ${{ steps.token-generator.outputs.token }}
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
github.rest.issues.createComment({ issue_number, owner, repo, body: "The `validations` job has failed; please review the `Files changed` tab for possible suggestions to resolve." });

0 comments on commit 76996aa

Please sign in to comment.