19 Commits
v0.0.1 ... main

Author SHA1 Message Date
Devraj Mehta
01f2415f3d Merge pull request #9 from actions/devm33/check-write
Some checks failed
Test / test (ubuntu-24.04-arm) (push) Has been cancelled
Test / test (ubuntu-latest) (push) Has been cancelled
Add step to warn about unnecessary write permissions
2026-03-16 23:14:51 -04:00
Devraj Mehta
0d854367d9 Add step to warn about unnecessary write permissions
Probes the github-token for write access to actions, checks, contents,
deployments, issues, packages, pages, pull-requests, security-events,
and statuses. Emits a visible warning if any write scopes are detected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-16 23:14:29 -04:00
Devraj Mehta
f070e091bc Merge pull request #8 from actions/fix-release-tag-fetch
Fix: fetch new tag before updating major version tag
2026-03-10 23:21:50 -04:00
Devraj Mehta
bf52dcb0f1 Fix: fetch new tag before updating major version tag
gh release create creates the tag on the remote, so we need to fetch
it before we can reference it locally for the major version tag update.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-10 22:00:28 -04:00
Devraj Mehta
72d90beb74 Merge pull request #7 from actions/slim
Fix runner name
2026-03-10 21:48:37 -04:00
Devraj Mehta
95516055b3 Fix runner name 2026-03-10 21:48:07 -04:00
Devraj Mehta
d5f1a25f77 Merge pull request #6 from actions/release-workflow
Add release workflow
2026-03-10 21:46:26 -04:00
Devraj Mehta
d278e42d43 Add release workflow
Add a workflow_dispatch workflow that bumps the version (patch/minor/major),
creates a GitHub release with auto-generated notes, and updates the major
version tag.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-10 21:45:33 -04:00
Devraj Mehta
14747e0edd Merge pull request #5 from actions/token
Fix version
2026-03-10 21:37:53 -04:00
Devraj Mehta
9f29266402 Fix duplicate env key in Install Copilot CLI step
Merge GITHUB_TOKEN into the single env block to fix the 'env is already
defined' validation error in GitHub Actions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-10 20:55:51 -04:00
Devraj Mehta
5d0b3111f2 Update README to use @v0 version tag
The v1 tag doesn't exist yet — use v0 to match the current 0.x.x release series.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-10 20:55:09 -04:00
Devraj Mehta
9a31240795 Merge pull request #4 from actions/token
Use GitHub token to download Copilot CLI
2026-03-10 16:59:23 -04:00
Devraj Mehta
ce338b190a Use GitHub token to download Copilot CLI 2026-03-10 16:58:53 -04:00
Devraj Mehta
4689bdf64c Merge pull request #3 from actions/readme
Update readme
2026-03-10 15:47:59 -04:00
Devraj Mehta
6a38ddcf7d Update readme 2026-03-10 15:47:44 -04:00
Devraj Mehta
917a4b603e Merge pull request #2 from actions/conduct
Add CODE_OF_CONDUCT.md and CONTRIBUTING.md files
2026-03-10 15:46:46 -04:00
Devraj Mehta
200f18a7d8 Add CODE_OF_CONDUCT.md and CONTRIBUTING.md files 2026-03-10 15:46:22 -04:00
Devraj Mehta
e86547e619 Merge pull request #1 from actions/update-license
Update license
2026-03-10 15:41:21 -04:00
Devraj Mehta
3c5dd47bd5 Update license 2026-03-10 15:40:26 -04:00
6 changed files with 245 additions and 11 deletions

73
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: Version bump type
required: true
default: patch
type: choice
options:
- patch
- minor
- major
jobs:
release:
runs-on: ubuntu-slim
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine new version
id: version
run: |
# Get the latest semver tag
LATEST_TAG=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -n1)
if [ -z "$LATEST_TAG" ]; then
echo "No existing version tag found"
exit 1
fi
# Strip leading 'v' and split into components
VERSION="${LATEST_TAG#v}"
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
case "${{ inputs.bump }}" in
major)
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
;;
minor)
MINOR=$((MINOR + 1))
PATCH=0
;;
patch)
PATCH=$((PATCH + 1))
;;
esac
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
echo "previous=$LATEST_TAG" >> "$GITHUB_OUTPUT"
echo "new=$NEW_VERSION" >> "$GITHUB_OUTPUT"
echo "major=v${MAJOR}" >> "$GITHUB_OUTPUT"
echo "Bumping $LATEST_TAG -> $NEW_VERSION"
- name: Create GitHub release
run: |
gh release create "${{ steps.version.outputs.new }}" \
--generate-notes \
--notes-start-tag "${{ steps.version.outputs.previous }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update major version tag
run: |
git fetch origin tag "${{ steps.version.outputs.new }}"
git tag -f "${{ steps.version.outputs.major }}" "${{ steps.version.outputs.new }}"
git push -f origin "${{ steps.version.outputs.major }}"

76
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at opensource@github.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

30
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,30 @@
## Contributing
[fork]: https://github.com/actions/setup-copilot/fork
[pr]: https://github.com/actions/setup-copilot/compare
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE.txt).
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
## Submitting a pull request
1. [Fork][fork] and clone the repository
1. Create a new branch: `git checkout -b my-branch-name`
1. Make your change, add tests, and make sure the tests and linter still pass
1. Push to your fork and [submit a pull request][pr]
1. Pat yourself on the back and wait for your pull request to be reviewed and merged.
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
- Write tests.
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
## Resources
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
- [GitHub Help](https://help.github.com)

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2026 GitHub
Copyright GitHub, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -6,10 +6,10 @@ A GitHub Action to install the [GitHub Copilot CLI](https://github.com/github/co
```yaml
steps:
- uses: actions/setup-copilot@v1
- uses: actions/setup-copilot@v0
with:
version: "latest" # optional, defaults to "latest"
github-token: ${{ secrets.COPILOT_TOKEN }} # optional, defaults to github.token
github-token: ${{ secrets.GITHUB_TOKEN }} # optional, defaults to github.token
- run: copilot --version
```
@@ -18,7 +18,7 @@ steps:
| Input | Description | Required | Default |
| -------------- | ------------------------------------------------- | -------- | ---------------- |
| `version` | Version to install (`latest`, `prerelease`, or a specific version like `1.0.0`) | No | `latest` |
| `github-token` | GitHub token for Copilot authentication | No | `github.token` |
| `github-token` | GitHub token for downloading Copilot CLI | No | `github.token` |
## Outputs
@@ -31,13 +31,13 @@ steps:
### Install latest version
```yaml
- uses: actions/setup-copilot@v1
- uses: actions/setup-copilot@v0
```
### Install a specific version
```yaml
- uses: actions/setup-copilot@v1
- uses: actions/setup-copilot@v0
with:
version: "1.2.3"
```
@@ -45,9 +45,9 @@ steps:
### Use with a custom token
```yaml
- uses: actions/setup-copilot@v1
- uses: actions/setup-copilot@v0
with:
github-token: ${{ secrets.COPILOT_TOKEN }}
github-token: ${{ secrets.GH_TOKEN }}
```
## How it works
@@ -57,3 +57,11 @@ This action uses the [official Copilot CLI install script](https://gh.io/copilot
## License
[MIT](LICENSE)
## Contributions
Contributions are welcome! See [Contributor's Guide](CONTRIBUTING.md)
## Code of Conduct
:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)

View File

@@ -10,7 +10,7 @@ inputs:
required: false
default: "latest"
github-token:
description: "GitHub token for Copilot authentication. Defaults to the workflow token."
description: "GitHub token to download Copilot CLI. Defaults to the workflow token."
required: false
default: ${{ github.token }}
@@ -27,17 +27,64 @@ runs:
env:
VERSION: ${{ inputs.version }}
PREFIX: ${{ runner.tool_cache }}/copilot
GITHUB_TOKEN: ${{ inputs.github-token }}
run: curl -fsSL https://gh.io/copilot-install | bash
- name: Add to PATH
shell: bash
run: echo "${{ runner.tool_cache }}/copilot/bin" >> "$GITHUB_PATH"
- name: Set GITHUB_TOKEN
- name: Check for unnecessary write permissions
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: echo "GITHUB_TOKEN=${GH_TOKEN}" >> "$GITHUB_ENV"
run: |
API="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY"
writes_found=()
# Probe write access by sending invalid requests to write endpoints.
# 422/409 = token has write permission (passed auth, failed validation)
# 403 = token does not have write permission
probe_write() {
local scope="$1" url="$2" method="${3:-POST}" body="${4:-\{\}}"
code=$(curl -s -o /dev/null -w "%{http_code}" \
-X "$method" \
-H "Authorization: bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
"$url" -d "$body")
case "$code" in
2[0-9][0-9]|422|409) writes_found+=("$scope") ;;
esac
}
probe_write "actions" "$API/actions/workflows/0/dispatches" POST '{"ref":"__probe__"}'
probe_write "checks" "$API/check-runs" POST '{}'
probe_write "contents" "$API/contents/__probe__" PUT '{"message":"probe"}'
probe_write "deployments" "$API/deployments" POST '{}'
probe_write "issues" "$API/issues" POST '{}'
probe_write "packages" "$GITHUB_API_URL/user/packages/container/__nonexistent__/versions/0" DELETE ''
probe_write "pages" "$API/pages" POST '{}'
probe_write "pull-requests" "$API/pulls" POST '{}'
probe_write "statuses" "$API/statuses/$GITHUB_SHA" POST '{}'
if [ ${#writes_found[@]} -gt 0 ]; then
echo ""
echo "::warning::⚠️ The github-token passed to setup-copilot has write permissions: ${writes_found[*]}. Granting write permissions to the Copilot CLI in Actions workflows is a security risk. Recommend scoping your token with least-privilege permissions."
{
echo "### ⚠️ setup-copilot: Excessive Token Permissions"
echo ""
echo "The \`github-token\` input has **write** access to: \`${writes_found[*]}\`."
echo ""
echo "Giving write permissions to the Copilot CLI in Actions workflows is a security risk."
echo ""
echo "**Recommendation:** add a \`permissions\` block to your job:"
echo '```yaml'
echo "permissions:"
echo " contents: read"
echo '```'
echo "and add a separate job with write permissions for steps that need it."
} >> "$GITHUB_STEP_SUMMARY"
fi
- name: Verify installation
id: version