b3d2a1837c
Bumps the ci_dependencies group with 14 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `5.0.0` | `6.0.2` | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.3.1` | `6.0.0` | | [actions/download-artifact](https://github.com/actions/download-artifact) | `6.0.0` | `7.0.0` | | [actions/create-github-app-token](https://github.com/actions/create-github-app-token) | `2.1.4` | `2.2.1` | | [docker/build-push-action](https://github.com/docker/build-push-action) | `6.18.0` | `6.19.2` | | [docker/login-action](https://github.com/docker/login-action) | `3.6.0` | `3.7.0` | | [actions/setup-node](https://github.com/actions/setup-node) | `5.0.0` | `6.2.0` | | [actions/cache](https://github.com/actions/cache) | `4.3.0` | `5.0.3` | | [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) | `2.7.0` | `2.8.0` | | [actions-rust-lang/setup-rust-toolchain](https://github.com/actions-rust-lang/setup-rust-toolchain) | `1.13.0` | `1.15.2` | | [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) | `2.7.8` | `2.8.2` | | [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) | `2.4.0` | `3.2.0` | | [tj-actions/changed-files](https://github.com/tj-actions/changed-files) | `47.0.0` | `47.0.4` | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `5.5.1` | `5.5.2` | Updates `actions/checkout` from 5.0.0 to 6.0.2 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/08c6903cd8c0fde910a37f88322edcfb5dd907a8...de0fac2e4500dabe0009e67214ff5f5447ce83dd) Updates `actions/upload-artifact` from 4.3.1 to 6.0.0 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4.3.1...b7c566a772e6b6bfb58ed0dc250532a479d7789f) Updates `actions/download-artifact` from 6.0.0 to 7.0.0 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/018cc2cf5baa6db3ef3c5f8a56943fffe632ef53...37930b1c2abaa49bbe596cd826c3c89aef350131) Updates `actions/create-github-app-token` from 2.1.4 to 2.2.1 - [Release notes](https://github.com/actions/create-github-app-token/releases) - [Commits](https://github.com/actions/create-github-app-token/compare/67018539274d69449ef7c02e8e71183d1719ab42...29824e69f54612133e76f7eaac726eef6c875baf) Updates `docker/build-push-action` from 6.18.0 to 6.19.2 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/263435318d21b8e681c14492fe198d362a7d2c83...10e90e3645eae34f1e60eeb005ba3a3d33f178e8) Updates `docker/login-action` from 3.6.0 to 3.7.0 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/5e57cd118135c172c3672efd75eb46360885c0ef...c94ce9fb468520275223c153574b00df6fe4bcc9) Updates `actions/setup-node` from 5.0.0 to 6.2.0 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v5...6044e13b5dc448c55e2357c09f80417699197238) Updates `actions/cache` from 4.3.0 to 5.0.3 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/0057852bfaa89a56745cba8c7296529d2fc39830...cdf6c1fa76f9f475f3d7449005a359c84ca0f306) Updates `lycheeverse/lychee-action` from 2.7.0 to 2.8.0 - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/a8c4c7cb88f0c7386610c35eb25108e448569cb0...8646ba30535128ac92d33dfc9133794bfdd9b411) Updates `actions-rust-lang/setup-rust-toolchain` from 1.13.0 to 1.15.2 - [Release notes](https://github.com/actions-rust-lang/setup-rust-toolchain/releases) - [Changelog](https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions-rust-lang/setup-rust-toolchain/compare/v1.13...1780873c7b576612439a134613cc4cc74ce5538c) Updates `Swatinem/rust-cache` from 2.7.8 to 2.8.2 - [Release notes](https://github.com/swatinem/rust-cache/releases) - [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md) - [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.8...779680da715d629ac1d338a641029a2f4372abb5) Updates `actions/attest-build-provenance` from 2.4.0 to 3.2.0 - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) - [Commits](https://github.com/actions/attest-build-provenance/compare/v2.4.0...96278af6caaf10aea03fd8d33a09a777ca52d62f) Updates `tj-actions/changed-files` from 47.0.0 to 47.0.4 - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/24d32ffd492484c1d75e0c0b894501ddb9d30d62...7dee1b0c1557f278e5c7dc244927139d78c0e22a) Updates `codecov/codecov-action` from 5.5.1 to 5.5.2 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/5a1091511ad55cbe89839c7260b706298ca349f7...671740ac38dd9b0130fbe1cec585b89eea48d3de) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 6.0.2 dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci_dependencies - dependency-name: actions/upload-artifact dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci_dependencies - dependency-name: actions/download-artifact dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci_dependencies - dependency-name: actions/create-github-app-token dependency-version: 2.2.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: ci_dependencies - dependency-name: docker/build-push-action dependency-version: 6.19.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: ci_dependencies - dependency-name: docker/login-action dependency-version: 3.7.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: ci_dependencies - dependency-name: actions/setup-node dependency-version: 6.2.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci_dependencies - dependency-name: actions/cache dependency-version: 5.0.3 dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci_dependencies - dependency-name: lycheeverse/lychee-action dependency-version: 2.8.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: ci_dependencies - dependency-name: actions-rust-lang/setup-rust-toolchain dependency-version: 1.15.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: ci_dependencies - dependency-name: Swatinem/rust-cache dependency-version: 2.8.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: ci_dependencies - dependency-name: actions/attest-build-provenance dependency-version: 3.2.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci_dependencies - dependency-name: tj-actions/changed-files dependency-version: 47.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: ci_dependencies - dependency-name: codecov/codecov-action dependency-version: 5.5.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: ci_dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
335 lines
12 KiB
YAML
335 lines
12 KiB
YAML
name: Command
|
|
|
|
on:
|
|
issue_comment: # listen for comments on issues
|
|
types: [created]
|
|
|
|
permissions: # allow the action to comment in PR
|
|
contents: read
|
|
issues: write
|
|
pull-requests: write
|
|
actions: read
|
|
|
|
jobs:
|
|
is-org-member:
|
|
if: startsWith(github.event.comment.body, '/cmd')
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
member: ${{ steps.is-member.outputs.result }}
|
|
steps:
|
|
- name: Generate token
|
|
id: generate_token
|
|
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
|
with:
|
|
app-id: ${{ secrets.CMD_BOT_APP_ID }}
|
|
private-key: ${{ secrets.CMD_BOT_APP_KEY }}
|
|
|
|
- name: Check if user is a member of the organization
|
|
id: is-member
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ steps.generate_token.outputs.token }}
|
|
result-encoding: string
|
|
script: |
|
|
const fs = require("fs");
|
|
try {
|
|
const org = '${{ github.event.repository.owner.login }}';
|
|
const username = '${{ github.event.comment.user.login }}';
|
|
|
|
const membership = await github.rest.orgs.checkMembershipForUser({
|
|
org: org,
|
|
username: username
|
|
});
|
|
|
|
console.log(membership, membership.status, membership.status === 204);
|
|
|
|
if (membership.status === 204) {
|
|
return 'true';
|
|
} else {
|
|
console.log(membership);
|
|
fs.appendFileSync(process.env["GITHUB_STEP_SUMMARY"], `${membership.data && membership.data.message || 'Unknown error happened, please check logs'}`);
|
|
}
|
|
} catch (error) {
|
|
console.log(error)
|
|
}
|
|
|
|
return 'false';
|
|
|
|
acknowledge:
|
|
if: ${{ startsWith(github.event.comment.body, '/cmd') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Add reaction to triggered comment
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
github.rest.reactions.createForIssueComment({
|
|
comment_id: ${{ github.event.comment.id }},
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
content: 'eyes'
|
|
})
|
|
|
|
clean:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clean previous comments
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
if: ${{ startsWith(github.event.comment.body, '/cmd') && contains(github.event.comment.body, '--clean') }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
github.rest.issues.listComments({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo
|
|
}).then(comments => {
|
|
for (let comment of comments.data) {
|
|
console.log(comment)
|
|
if (
|
|
${{ github.event.comment.id }} !== comment.id &&
|
|
(
|
|
(
|
|
(
|
|
comment.body.startsWith('Command') ||
|
|
comment.body.startsWith('<details><summary>Command') ||
|
|
comment.body.startsWith('Sorry, only ')
|
|
) && comment.user.type === 'Bot'
|
|
) ||
|
|
(comment.body.startsWith('/cmd') && comment.user.login === context.actor)
|
|
)
|
|
) {
|
|
github.rest.issues.deleteComment({
|
|
comment_id: comment.id,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
get-pr-info:
|
|
if: ${{ startsWith(github.event.comment.body, '/cmd') }}
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
CMD: ${{ steps.get-comment.outputs.group2 }}
|
|
pr-branch: ${{ steps.get-pr.outputs.pr_branch }}
|
|
repo: ${{ steps.get-pr.outputs.repo }}
|
|
steps:
|
|
- name: Get command
|
|
uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b # v2.0.2
|
|
id: get-comment
|
|
with:
|
|
text: ${{ github.event.comment.body }}
|
|
regex: "^(\\/cmd )([-\\/\\s\\w.=:]+)$" # see explanation in docs/contributor/commands-readme.md#examples
|
|
|
|
# Get PR branch name, because the issue_comment event does not contain the PR branch name
|
|
- name: Check if the issue is a PR
|
|
id: check-pr
|
|
run: |
|
|
if [ -n "${{ github.event.issue.pull_request.url }}" ]; then
|
|
echo "This is a pull request comment"
|
|
else
|
|
echo "This is not a pull request comment"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Get PR Branch Name and Repo
|
|
if: steps.check-pr.outcome == 'success'
|
|
id: get-pr
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
script: |
|
|
const pr = await github.rest.pulls.get({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
pull_number: context.issue.number,
|
|
});
|
|
const prBranch = pr.data.head.ref;
|
|
const repo = pr.data.head.repo.full_name;
|
|
console.log(prBranch, repo)
|
|
core.setOutput('pr_branch', prBranch);
|
|
core.setOutput('repo', repo);
|
|
|
|
- name: Use PR Branch Name and Repo
|
|
env:
|
|
PR_BRANCH: ${{ steps.get-pr.outputs.pr_branch }}
|
|
REPO: ${{ steps.get-pr.outputs.repo }}
|
|
CMD: ${{ steps.get-comment.outputs.group2 }}
|
|
run: |
|
|
echo "The PR branch is $PR_BRANCH"
|
|
echo "The repository is $REPO"
|
|
echo "The CMD is $CMD"
|
|
|
|
help:
|
|
needs: [clean, get-pr-info]
|
|
if: ${{ startsWith(github.event.comment.body, '/cmd') && contains(github.event.comment.body, '--help') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Save output of help
|
|
id: help
|
|
env:
|
|
CMD: ${{ needs.get-pr-info.outputs.CMD }} # to avoid "" around the command
|
|
run: |
|
|
python3 -m pip install -r .github/scripts/generate-prdoc.requirements.txt
|
|
echo 'help<<EOF' >> $GITHUB_OUTPUT
|
|
python3 .github/scripts/cmd/cmd.py $CMD >> $GITHUB_OUTPUT
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
|
|
- name: Comment PR (Help)
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: `<details><summary>Command help:</summary>
|
|
|
|
\`\`\`
|
|
${{ steps.help.outputs.help }}
|
|
\`\`\`
|
|
|
|
</details>`
|
|
})
|
|
|
|
- name: Add confused reaction on failure
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
if: ${{ failure() }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
github.rest.reactions.createForIssueComment({
|
|
comment_id: ${{ github.event.comment.id }},
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
content: 'confused'
|
|
})
|
|
|
|
- name: Add 👍 reaction on success
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
if: ${{ !failure() }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
github.rest.reactions.createForIssueComment({
|
|
comment_id: ${{ github.event.comment.id }},
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
content: '+1'
|
|
})
|
|
|
|
set-image:
|
|
needs: [clean, get-pr-info]
|
|
if: ${{ startsWith(github.event.comment.body, '/cmd') && !contains(github.event.comment.body, '--help') }}
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CMD: ${{ needs.get-pr-info.outputs.CMD }}
|
|
outputs:
|
|
IMAGE: ${{ steps.set-image.outputs.IMAGE }}
|
|
RUNNER: ${{ steps.set-image.outputs.RUNNER }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- id: set-image
|
|
run: |
|
|
BODY=$(echo "$CMD" | xargs) # remove whitespace
|
|
IMAGE_OVERRIDE=$(echo $BODY | grep -oe 'docker.io/pezkuwichain/ci-unified:.*\s' | xargs)
|
|
|
|
cat .github/env >> $GITHUB_OUTPUT
|
|
|
|
if [ -n "$IMAGE_OVERRIDE" ]; then
|
|
IMAGE=$IMAGE_OVERRIDE
|
|
echo "IMAGE=$IMAGE" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
# Use GitHub-hosted runners for Pezkuwi SDK
|
|
echo "RUNNER=ubuntu-latest" >> $GITHUB_OUTPUT
|
|
- name: Print outputs
|
|
run: |
|
|
echo "RUNNER=${{ steps.set-image.outputs.RUNNER }}"
|
|
echo "IMAGE=${{ steps.set-image.outputs.IMAGE }}"
|
|
|
|
check-pr-author:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
is_author: ${{ steps.check-author.outputs.result }}
|
|
steps:
|
|
- name: Generate token
|
|
id: generate_token
|
|
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
|
with:
|
|
app-id: ${{ secrets.CMD_BOT_APP_ID }}
|
|
private-key: ${{ secrets.CMD_BOT_APP_KEY }}
|
|
|
|
- name: Check if user is PR author
|
|
id: check-author
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ steps.generate_token.outputs.token }}
|
|
result-encoding: string
|
|
script: |
|
|
const commentUser = '${{ github.event.comment.user.login }}';
|
|
const prNumber = ${{ github.event.issue.number }};
|
|
|
|
try {
|
|
const pr = await github.rest.pulls.get({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
pull_number: prNumber
|
|
});
|
|
|
|
const prAuthor = pr.data.user.login;
|
|
return commentUser === prAuthor ? 'true' : 'false';
|
|
} catch (error) {
|
|
console.error('Error checking PR author:', error);
|
|
return 'false';
|
|
}
|
|
|
|
run-cmd-workflow:
|
|
needs: [set-image, get-pr-info, is-org-member, check-pr-author]
|
|
runs-on: ubuntu-latest
|
|
# don't run on help command
|
|
if: ${{ startsWith(github.event.comment.body, '/cmd') && !contains(github.event.comment.body, '--help') }}
|
|
permissions: # run workflow
|
|
contents: read
|
|
issues: write
|
|
pull-requests: write
|
|
actions: write
|
|
env:
|
|
CMD: ${{ needs.get-pr-info.outputs.CMD }}
|
|
PR_BRANCH: ${{ needs.get-pr-info.outputs.pr-branch }}
|
|
RUNNER: ${{ needs.set-image.outputs.RUNNER }}
|
|
IMAGE: ${{ needs.set-image.outputs.IMAGE }}
|
|
REPO: ${{ needs.get-pr-info.outputs.repo }}
|
|
IS_ORG_MEMBER: ${{ needs.is-org-member.outputs.member }}
|
|
IS_PR_AUTHOR: ${{ needs.check-pr-author.outputs.is_author }}
|
|
COMMENT_ID: ${{ github.event.comment.id }}
|
|
PR_NUMBER: ${{ github.event.issue.number }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Start cmd with gh cli
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh workflow run cmd-run.yml \
|
|
--ref cmd-bot \
|
|
-f cmd="${CMD}" \
|
|
-f repo="${REPO}" \
|
|
-f pr_branch="${PR_BRANCH}" \
|
|
-f pr_num="${PR_NUMBER}" \
|
|
-f runner="${RUNNER}" \
|
|
-f is_org_member="${IS_ORG_MEMBER}" \
|
|
-f is_pr_author="${IS_PR_AUTHOR}" \
|
|
-f comment_id="${COMMENT_ID}" \
|
|
-f image="${IMAGE}" \
|
|
-f is_quiet="${{ contains(github.event.comment.body, '--quiet') }}"
|