forked from joinmisskey/release-actions
-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prevent from shell injection #3
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cdcaa94
do not use ${{ var }} in shell steps
anatawa12 2f08f49
chore(create-target): do not use ${{ var }} in shell steps
anatawa12 66d5d26
chore(merge): do not use ${{ var }} in shell steps
anatawa12 f874825
chore: use github builtin environment variable
anatawa12 36ba106
chore(release-edit-with-push): do not use ${{ var }} in shell steps
anatawa12 4c6dcdd
chore(release-edit-with-ready): do not use ${{ var }} in shell steps
anatawa12 2cc50e0
chore(actions): do not use ${{ var }} in shell steps
anatawa12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,8 +51,10 @@ jobs: | |
- uses: actions/checkout@v4 | ||
- name: git config | ||
run: | | ||
git config --local user.email "${{ inputs.user }}@users.noreply.github.com" | ||
git config --local user.name "${{ inputs.user }}" | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "$USER" | ||
env: | ||
USER: ${{ inputs.user }} | ||
# jqでpackage.jsonから現在のバージョンを取得 | ||
- name: Get current version | ||
run: | | ||
|
@@ -69,8 +71,10 @@ jobs: | |
result-encoding: string | ||
id: target_version | ||
- name: beta 0 | ||
run: echo "result=${{ steps.target_version.outputs.result }}-beta.0" >> $GITHUB_OUTPUT | ||
run: echo "result=$TARGET_VERSION-beta.0" >> $GITHUB_OUTPUT | ||
id: release_version | ||
env: | ||
TARGET_VERSION: ${{ steps.target_version.outputs.result }} | ||
# バージョンをpackage.jsonに書き込み | ||
- name: Write version | ||
uses: misskey-dev/release-manager-actions/.github/actions/rewrite-package-json@v1 | ||
|
@@ -87,14 +91,19 @@ jobs: | |
# CHANGELOG.mdのバージョンの書き換え | ||
- name: Modify CHANGELOG.md | ||
run: | | ||
sed -i 's/## Unreleased/## ${{ steps.target_version.outputs.result }}/' CHANGELOG.md | ||
sed -i "s/## Unreleased/## $TARGET_VERSION/" CHANGELOG.md | ||
env: | ||
TARGET_VERSION: ${{ steps.target_version.outputs.result }} | ||
# release/ブランチとタグを作成 | ||
- name: Commit version | ||
run: | | ||
git commit -am "Bump version to ${{ steps.release_version.outputs.result }}" | ||
git push origin HEAD:release/${{ steps.target_version.outputs.result }} | ||
git tag "${{ steps.release_version.outputs.result }}" | ||
git push origin "${{ steps.release_version.outputs.result }}" | ||
git commit -am "Bump version to $VERSION_NAME" | ||
git push origin "HEAD:release/$TARGET_VERSION" | ||
git tag "$VERSION_NAME" | ||
git push origin "$VERSION_NAME" | ||
env: | ||
VERSION_NAME: ${{ steps.release_version.outputs.result }} | ||
TARGET_VERSION: ${{ steps.target_version.outputs.result }} | ||
# リリースを作成 | ||
- uses: actions/create-github-app-token@v1 | ||
id: release-app-token | ||
|
@@ -105,12 +114,17 @@ jobs: | |
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.use_external_app_to_release && steps.release-app-token.outputs.token || secrets.GITHUB_TOKEN }} | ||
VERSION_NAME: ${{ steps.release_version.outputs.result }} | ||
CHANGELOG: ${{ steps.changelog.outputs.changelog }} | ||
run: | | ||
gh release create "${{ steps.release_version.outputs.result }}" --prerelease --title "${{ steps.release_version.outputs.result }}" --notes "${{ steps.changelog.outputs.changelog }}" | ||
gh release create "$VERSION_NAME" --prerelease --title "$VERSION_NAME" --notes "$CHANGELOG" | ||
# PRを作成 | ||
- name: Create PR | ||
run: | | ||
gh pr create --draft --title "Release: ${{ steps.target_version.outputs.result }}" --body "${{ steps.changelog.outputs.changelog }}" --head release/${{ steps.target_version.outputs.result }} --base ${{ github.ref_name }} | ||
gh pr create --draft --title "Release: TARGET_VERSION" --body "$CHANGELOG" --head "release/$TARGET_VERSION" --base "$GITHUB_REF_NAME" | ||
env: | ||
TARGET_VERSION: ${{ steps.target_version.outputs.result }} | ||
CHANGELOG: ${{ steps.changelog.outputs.changelog }} | ||
|
||
# rulesetを切り替え | ||
- uses: actions/create-github-app-token@v1 | ||
|
This file contains 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
This file contains 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
This file contains 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
とりあえずこれである程度動くのでこのままでいいと思うけど、コマンドの引数はデータの受け渡しには向いておらず、長さの上限もあまり長くないので将来的にはファイル等を介したい